string index out of bound exception
import java.util.*; import java.lang.*; import java.io.*; public class pali { public static void main (String[] args) { Scanner sc= new Scanner(System.in); int test_cases= sc.nextInt(); for(int i= 0 ; i< test_cases;i++) { int len= sc.nextInt(); String str=sc.nextLine(); String p = ""; for(int j=0;j<len;j++) p= str.charAt(j)+p; System.out.println("p"); if(p.equals(str)) System.out.println("Yes"); else System.out.println("No"); } } } /* Exception in thread "main"// java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextInt(Scanner.java:2117) at java.util.Scanner.nextInt(Scanner.java:2076) at gfg_pali.main(File.java:14) */