Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Aaj Kemon Bodh Korcho

By ssavi1994 · Limits 1s, 1.0 GB

One of our famous admin of Programming Problem in Bengali group is a diehard supporter of Barcelona FC. When there is a match between Barcelona and Real Madrid he never misses it. Today there is a match between Barcelona and Real Madrid. And as usual he is in front of the TV screen.
The weird fact of today’s match is – there is a GOAL in each and every second of the match (huh!!! ). All the goals may not be valid i.e. some of the goals can be done from OFF SIDE which is out of the rules.

At the end of the match our Barcelona supporter wants to make comment about the match on the famous social networking site FunCook.
The comments he decided to post are - “Aaj Kemon Bodh Korcho”(without quotes) if Barcelona won the match , “Hala Madrid” (without quotes) if Real Madrid won the match or "Meh :"( without quotes) if there is no winner.

Noticing the time of each goal, he figured out that the goals that are done from OFF SIDE are belongs to a famous series (Sorry I forgot the name of the series). Some values of that series are given below:

Now can you help him to decide the suitable comment?


You’re given an integer number T which denotes the number of test cases (T <=100). In each of the T line contains a string (S) of following characters (B, M). The maximum length of the string will not be greater than 10⁵. Note that, the starting index will be 0.
If the ith character is B then it denotes a goal is done by Barcelona at ith second.
If the ith character is M then it denotes a goal is done by Real Madrid at ith second.


For each of the T lines you have to print the case number first according to the format Case #X where X is the case number. Then you have to print Aaj Kemon Bodh Korcho if Barcelona won the match or Hala Madrid if Real Madrid won the match. Otherwise print Meh :\ . For more clarification see the samples below.


Case #1: Hala Madrid
Case #2: Aaj Kemon Bodh Korcho



68% Solution Ratio

ArifHosanEarliest, Sep '17

riyad000Fastest, 0.0s

bisnu_sarkarLightest, 131 kB

sjsakibShortest, 456B


Login to submit


Concept: Fibonacchi Number, Looping. Details: To solve the problem you first have to generate fibon...

Toph uses cookies. By continuing you agree to our Cookie Policy.