cf D. Queue

http://codeforces.com/contest/353/problem/D

 1 #include <cstdio>
 2 #include <cstring>
 3 #include <algorithm>
 4 #define maxn 10000010
 5 using namespace std;
 6 
 7 char str[maxn];
 8 int main()
 9 {
10     scanf("%s",str);
11     int k=strlen(str);
12     int ans=0,t1=0;
13     for(int i=0; i<k; i++)
14     {
15         if(str[i]=='M') t1++;
16         else if(t1) ans=max(ans+1,t1);
17     }
18     printf("%d\n",ans);
19     return 0;
20 }
View Code

 

posted @ 2014-08-23 19:54  null1019  阅读(85)  评论(0编辑  收藏  举报