-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPangram.java
More file actions
39 lines (26 loc) · 845 Bytes
/
Copy pathPangram.java
File metadata and controls
39 lines (26 loc) · 845 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
package String.Easy;
import java.util.HashMap;
import java.util.Scanner;
public class Pangram {
public static void main(String[] arg){
Scanner scan = new Scanner(System.in);
String s=scan.nextLine();
scan.close();
// We promptly judged antique ivory buckles for the next prize (pangram)
System.out.println(isPanagram(s) ? "Panagram" : "Not Panagram");
}
private static boolean isPanagram(String str){
HashMap<Character,Integer> charMap = new HashMap<Character, Integer>();
str = str.toLowerCase();
int size = str.length();
for(int i=0;i<size;i++){
if(!charMap.containsKey(str.charAt(i)) && str.charAt(i)>='a' && str.charAt(i)<='z'){
charMap.put(str.charAt(i), 1);
}
}
if(charMap.size()==26)
return true;
else
return false;
}
}