1 solutions
-
0Bullet LV 4 MOD @ 2024-03-29 12:03:24
Author Code (Kamonasish Roy) :
#include<bits/stdc++.h>
using namespace std;
const long long M=2e5+10,MOD=2000000007;
typedef long long ll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t=1;
cin>>t;
while(t--){
string s;
cin>>s;
int p=0,q=0;
for(char c: s)p+=(c=='p'),q+=(c=='q');
if(p>q)cout<<"Roy\n";
else if(q>p)cout<<"Mahfuj\n";
else cout<<"Draw\n";
}
return 0;
}Tester Code (Jahirul Islam Hridoy):
void solve()
{
string s ; cin >> s ; map < char , int > mp ;
for(auto it : s) mp[it]++ ;
if(mp['p'] == mp['q']) cout << "Draw" << "\n" ;
else if(mp['p'] > mp['q']) cout << "Roy" << "\n" ;
else cout << "Mahfuj" <<"\n" ;
}
int main()
{
Heart
int t ; cin >> t ; while(t--) solve() ;
}
- 1
Information
- ID
- 1040
- Difficulty
- 9
- Category
- Beginners Click to Show
- Tags
- (None)
- # Submissions
- 9
- Accepted
- 6
- Accepted Ratio
- 67%
- Uploaded By