提交时间:2025-04-13 11:03:44
运行 ID: 317761
#include<bits/stdc++.h> using namespace std; string s; int mi,B,R,G; int main(){ cin>>s; sort(s.begin(),s.end()); cout<<s<<endl; for(int i=0;i<s.size();i++){ if(s[i]=='B') B++; else if(s[i]=='R') R++; else if(s[i]=='G') G++; } B/=3; G/=2; mi=min(B,R); mi=min(mi,G); cout<<mi; return 0; }