File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` java
2+ import java.io.* ;
3+ import java.util.* ;
4+
5+ public class Main {
6+ static boolean check (String s ){
7+ if (s. length() == 1 )
8+ return true ;
9+ int mid= s. length() / 2 ;
10+ for (int i= 0 ; i < mid; i++ ){
11+ if (s. charAt(i) == s. charAt(s. length()- 1 - i))
12+ return false ;
13+ }
14+ return check(s. substring(0 , mid)) && check(s. substring(mid+ 1 ));
15+ }
16+
17+ public static void main (String [] args )throws IOException {
18+ BufferedReader br = new BufferedReader (new InputStreamReader (System . in));
19+ int t = Integer . parseInt(br. readLine());
20+ StringBuilder sb= new StringBuilder ();
21+ while (t-- > 0 ){
22+ sb. append(check(br. readLine() ) ? " YES\n " : " NO\n " );
23+ }
24+
25+ System . out. print(sb. toString());
26+ br. close();
27+ }
28+ }
29+
30+ ```
You can’t perform that action at this time.
0 commit comments