Lapindrom prob please help I am new to codechef

why wrong answer is giving even if i am getting expected outputs on every test cases For Lapindrom problem?


/* package codechef; // don’t place package name! */

import java.util.;
import java.lang.

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
public static void main (String[] args) throws java.lang.Exception
// your code goes here
String S="", S1="",S2="";
int n=0;
Scanner sc = new Scanner(;
n = sc.nextInt();

	for(int i=1;i<=n ;i++)
	S =;
    S1 = S.substring(0,S.length()/2);
        if(S.length()%2 == 0)
        S2 = S.substring(S.length()/2,S.length());
        S2 = S.substring(S.length()/2 + 1,S.length());
   if(calAscii(S1) == calAscii(S2))

static int calAscii(String S)
    int sum =0;
    for(int i =0 ;i<S.length();i++)
        sum += S.codePointAt(i);
    return sum ;


This is because getting all the test cases doesn’t mean your logic for the program is correct or its implementation. As I can see the logic itself is not totally correct so it is getting WA on submitting.

Thankyou I got it