You are viewing a single comment's thread. Return to all comments →
hi JohnPas
what is the difference you see between your code and my code
public static void main(String[] args) { Scanner in = new Scanner(System.in); boolean funny = true; int testCases = in.nextInt(); for(int i=0;i < testCases;i++){ String str = in.next(); String revStr = new StringBuilder(str).reverse().toString(); for(int j=1; j < str.length();j++){ if(Math.abs((str.charAt(j) - str.charAt(j-1))) != Math.abs((revStr.charAt(j) - revStr.charAt(j-1)))){ funny = false; } } System.out.println(funny? "Funny":"Not Funny"); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Funny String
You are viewing a single comment's thread. Return to all comments →
hi JohnPas
what is the difference you see between your code and my code