#include<bits/stdc++.h> using namespace std; int main() { string word; int tc; int m,a,r,g,t,ii,min; while(cin>>tc) { while(tc--) { m=a=r=g=t=ii=0; min=600; cin>>word; int l = word.length(); for(int i=0; i<l; i++) { if(word[i]=='A') a=a+1; else if(word[i]=='M') m=m+1; else if(word[i]=='R') r = r+1; else if(word[i]=='G') g=g+1; else if(word[i]=='I') ii=ii+1; else if(word[i]=='T') t=t+1; } a=a/3; r=r/2; if(a<min) min=a; if(m<min) min =m; if(r<min) min=r; if(g<min) min =g; if(ii<min) min=ii; if(t<min) min=t; cout<<min<<endl; } } }
Monday, April 4, 2016
UVA 12626
Labels:
UVA Solution
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)