UVALive 5968

假如出现SS 那么表示Spring,如果出现SX的话,就表示WINTER,末尾出现S不管
 1 #include <map>

 2 #include <set>

 3 #include <list>

 4 #include <cmath>

 5 #include<cctype>

 6 #include <ctime>

 7 #include <deque>

 8 #include <stack>

 9 #include <queue>

10 #include <cstdio>

11 #include <string>

12 #include <vector>

13 #include<climits>

14 #include <cstdlib>

15 #include <cstring>

16 #include <iostream>

17 #include <algorithm>

18 #define LL long long

19 #define PI 3.1415926535897932626

20 using namespace std;

21 int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);}

22 #define MAXN 1000

23 char str[MAXN];

24 int main()

25 {

26     //freopen("sample.txt","r",stdin);

27     int T;

28     int kase=1;

29     scanf("%d",&T);

30     while (T--)

31     {

32         scanf("%s",str);int ans1=0,ans2=0;

33         int len=strlen(str);//str[len]='#';

34         for (int i=0;i<len-1;i++)

35         {

36             if (str[i]=='S')

37             {

38                 if (str[i+1]==str[i]) ans2++;

39                 else ans1++;

40             }

41         }

42         printf("Case %d: %d / %d\n",kase++,ans2,ans1);

43     }

44     return 0;

45 }
View Code

 

你可能感兴趣的:(live)