You are viewing a single comment's thread. Return to all comments →
Scanner sc=new Scanner(System.in); String a=sc.next(); String b; int l=a.length(); int c=0; for(int i=0;i=2 { String r=new StringBuffer(b).reverse().toString(); if(r.equals(b)) c++; } } } System.out.println(c) } }
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Count Palindromes
You are viewing a single comment's thread. Return to all comments →
Scanner sc=new Scanner(System.in); String a=sc.next(); String b; int l=a.length(); int c=0; for(int i=0;i=2 { String r=new StringBuffer(b).reverse().toString(); if(r.equals(b)) c++; } } } System.out.println(c) } }