Sunday, April 24, 2016

Published April 24, 2016 by with 0 comment

UVA 12289 - One-Two-Three : Solution


#include <stdio.h>
#include <string.h>
int main()
{
    int t;
    scanf("%d",&t);
    while ( t-- )
    {
        char a[10];
        scanf("%s",a);
        if (strlen(a)==5) printf("3\n");
        else
        {
            int match=0;
            if (a[0] =='o') match++;
            if (a[1] =='n') match++;
            if (a[2] =='e') match++;
            if (match>1) printf("1\n");
            else printf("2\n");
        }
    }
    return 0;
}
      edit

0 comments:

Post a Comment