-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLAPIN.java
More file actions
38 lines (35 loc) · 806 Bytes
/
LAPIN.java
File metadata and controls
38 lines (35 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
https://www.codechef.com/LRNDSA01/problems/LAPIN
import java.util.*;
import java.lang.*;
import java.io.*;
class LAPIN
{
private static boolean Lapindrome(String st){
int[] ar = new int[26];
int len = st.length();
for(int i=0,j=len-1;i<j;i++,j--){
ar[st.charAt(i)-'a']++;
ar[st.charAt(j)-'a']--;
}
for(int i=0;i<26;i++){
if(ar[i]!=0)
return false;
}
return true;
}
public static void main (String[] args) throws java.lang.Exception
{
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t!=0){
t--;
String st = s.next();
if(Lapindrome(st)){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}