-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhashmap.java
More file actions
33 lines (29 loc) · 881 Bytes
/
hashmap.java
File metadata and controls
33 lines (29 loc) · 881 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
import java.util.*;
public class hashmap
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
char []c=s.toCharArray();
HashMap<Character,Character> map=new HashMap<Character,Character>();
map.put('0','0');
map.put('1','1');
map.put('8','8');
map.put('6','9');
map.put('9','6');
int i=0;
int j=c.length-1;
while (i <= j) {
if(!map.containsKey(c[i])) {
System.out.println("false");
break;
}
if(c[i] != map.get(c[j])){
System.out.println("false");
}
else{
System.out.println( "True");}
i++;
j--;
}
}