Accepted
Code
def counts_char(S):
return {char: S.count(char) for char in {'p', 'q'}}
def winner(counts):
p,q=counts["p"],counts["q"]
if p>q:
return "Roy"
if p<q:
return "Mahfuj"
return "Draw"
def main():
t = int(input().strip())
for i in range(t):
S = input().strip()
counts=counts_char(S)
result = winner(counts)
print(result)
if __name__ == "__main__":
main()
Information
- Submit By
- Type
- Submission
- Problem
- P1040 Character game
- Contest
- TLE_Headquarters - round #1
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-03-27 18:21:26
- Judged At
- 2024-11-11 03:37:11
- Judged By
- Score
- 100
- Total Time
- 16ms
- Peak Memory
- 3.074 MiB