Hello @kaushik_iska and @anton_lunyov. The testcases which checks the code of the user for the problem have wrong format. When you write the code in c# with the same logic as that of when you write it in c++ (https://www.codechef.com/viewsolution/33281485), you get the wrong answer. Its because of the format of the data which tests the code. Please check my submission here in c# (https://www.codechef.com/viewsolution/33280623) , which tries to convert the input in lower cases throws runtime error, while this submission which doesn;t (https://www.codechef.com/viewsolution/33280651) gives the wrong answer (wrong answer is fine as logic is not correct). But as the format of data is wrong , I have wasted lot of time on it. Please check the format of the data before putting any problem here. Thanks.