-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSaveIronMan.java
More file actions
44 lines (43 loc) · 769 Bytes
/
SaveIronMan.java
File metadata and controls
44 lines (43 loc) · 769 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
43
44
package practice;
import java.util.*;
public class saveIronman
{
void check(String s)
{
String res="";
String resRev="";
for(int i=0;i<s.length();i++)
{
char ch=s.charAt(i);
if(ch!=' '&&((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')))
{
res=res+s.charAt(i);
}
}
for(int i=res.length()-1;i>=0;i--)
{
resRev+=res.charAt(i);
}
if(res.equalsIgnoreCase(resRev))
{
System.out.println("Yes");
}
else
{
System.out.println("No");
}
}
public static void main(String args[])
{
saveIronman s=new saveIronman();
Scanner sc=new Scanner(System.in);
System.out.println("Enter the no of testcases");
int test=sc.nextInt();
sc.nextLine();
for(int i=0;i<test;i++)
{
String res=sc.nextLine();
s.check(res);
}
}
}