Sunday, April 24, 2016

UVA 11586 - Train Tracks -Solution

Unknown
#include <stdio.h>
#include <string.h>
int main()
{
    int t,m,f,i,len;
    scanf("%d",&t);
    getchar ();
    while (t--)
    {
        char str[500];
        m=0;
        f=0;
        gets(str);
        len=strlen(str);
        for (i=0;i<len;i++)
        {
            if (str[i]=='M') m++;
            else if (str[i]=='F') f++;
        }
        if (m==f && m>1 && f>1)
        printf("LOOP\n");
        else
        printf("NO LOOP\n");
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

1 comments:

  1. wrong,,,,FM MF- not loop but yours is loop,,,lack of corner tescase yours is accpeted.

    ReplyDelete

Coprights @ 2016,