Nowadays newly joined programmers of MU_ACM are doing incredible. Within few months they have learnt…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
I am looking at your second submission that yields Wrong Answer on sample and it seems you are not calling .strip() on the s.
Doesn’t looping over sys.stdin keep the newline character in the iteration variable? s actually has the newline character and you need to get rid of it by calling .strip() on it.