Saleh127

cf 1380B

Jul 12th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9. test
  10. {
  11. string a;
  12. char ch;
  13. ll i,j,k,l,c,d,e,f,r=0,s=0,p=0;
  14. cin>>a;
  15. for(i=0;i<a.size();i++)
  16. {
  17. if(a[i]=='R') r++;
  18. else if(a[i]=='P') p++;
  19. else s++;
  20. }
  21. l=max({r,p,s});
  22. if(l==r) ch='P';
  23. else if(l==p) ch='S';
  24. else ch='R';
  25. for(i=0;i<a.size();i++)
  26. {
  27. cout<<ch;
  28. }
  29. cout<<endl;
  30. }
  31.  
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment