+ 3
ans is already String then why this line String p=Character.toString(ans); You can't compare two String with == assignment. To compare String use equals method like this a.equals(b)
6th Feb 2020, 1:18 PM
AÍąJ
AÍąJ - avatar
0
now: ans=""; // added, always reset ans for new token test for(int j=l-1; j>=0; j--) { // ans = ans+Character.toString( s.charAt(j) ); ans += a.charAt(j); // check individual token a, instead whole input string s }
6th Feb 2020, 11:46 PM
zemiak