Help me understand the difference in logic

correct : CodeChef: Practical coding for everyone
partially correct : CodeChef: Practical coding for everyone
I have commented the difference in both the code . Please tell me why i am getting one correct and one partial correct . The logic used in both the code is same .