I am not able to understand the error in this code

import java.util.;
import java.lang.
;
import java.io.*;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner sc=new Scanner(System.in);
String s=sc.next();
String ss="";
char ch;
int i,l=s.length();
for(i=0;i<l;i++)
{
ch=s.charAt(i);
ss=ch+ss;
}
if(s.equals(ss))
System.out.println(“true”);
else
System.out.println(“false”);
}
}


i have made the changes to your code

Exception in thread “main” java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1371) at Main.main(Main.java:16)

@apoorvsingh27 the code works fine for me on ide and passes all the test cases please check again.

please mark your doubt as resolved if u are satisfied with the solution