Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<math.h>
- int min(int x,int y){
- if(x<y)
- return x;
- return y;
- }
- int main()
- {
- long long t,i,j,b,c,d,e,f,g,ans;
- char a[1000];
- while(scanf("%lld",&t)==1)
- {
- for(i=1;i<=t;i++)
- {
- b=0,c=0,d=0,e=0,f=0,g=0,h=0;
- scanf("%s",a);
- l=strlen(a);
- for(j=0;j<l;j++)
- {
- if(a[j]=='M')
- b=b+1;
- else if(a[j]=='A')
- c=c+1;
- else if(a[j]=='R')
- d=d+1;
- else if(a[j]=='G')
- e=e+1;
- else if(a[j]=='I')
- f=f+1;
- else if(a[j]=='T')
- g=g+1;
- }
- ans=min(min(min(min(min(b,c/3),d/2),e),f),g);
- printf("%lld\n",ans);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement