-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPal.java
More file actions
42 lines (38 loc) · 743 Bytes
/
Copy pathPal.java
File metadata and controls
42 lines (38 loc) · 743 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
39
40
41
42
import java.util.*;
import java.lang.*;
import java.io.*;
class GFG {
static boolean isPal(String str)
{
int i=0;
if(str.length() >100)
{
System.out.println("Too big string");
return false;
}
int j= str.length()-1;
while(i<j)
{
if (str.charAt(i)!=str.charAt(j))
return false;
i++;
j--;
}
return true;
}
public static void main (String[] args) {
//code
Scanner s = new Scanner(System.in);
int T = s.nextInt();
while(T>0)
{
String str = s.nextLine();
boolean flag= isPal(str);
if (flag)
System.out.println("Yes");
else
System.out.println("No");
T--;
}
}
}