Clash of programmers
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 1.0 s
Memory Limit: 256.0 MB
Description
- Mahfuz and Emon is planning to play a card game for leisure time. Sometimes Emon is very busy, otherwise they play the game. The rules are very simple :
- If a player wins a round, gets a point.
- If a player has won a set of rounds his points doubles.
- If a player gets atleast k point, the player wins the game. Game is ended as soon as a player reaches k points.
But heres the twist, as they both are hard core competitive programmer, Mahfuz and Emon changes rules for winning a round and winning a set in random manner, it is very hardly encrypted.In other words they can change the value K any time in the game.
You are given an integer \(N\) (number of rounds played) followed by a string containing only three type of characters 'M','E' and '?. 'M' means Mahfuz won the round; 'E' means Emon won the round and '?' means the winner is unknow.
Your task is to find the possible winner of the game.
Format
Input
first line takes an integer \(N\) : number of rounds
second line takes a string \(S\) : which represents N rounds
Output
print "Mahfuz" (without quote) if mahfuz is the winner, Print "Emon" if emon is the winner else print "IDK" .
Sample 1
input
5
EEMMM
output
Mahfuz
Sample 2
input
6
MEMEEE
output
Emon
Sample 3
input
6
MM?EE?
output
IDK
Brain booster #2
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 11
- Start at
- 2024-03-06 13:00
- End at
- 2024-03-06 17:00
- Duration
- 4.0 hour(s)
- Host
- Partic.
- 49