-
Notifications
You must be signed in to change notification settings - Fork 0
/
pangram.java
49 lines (43 loc) · 955 Bytes
/
pangram.java
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
45
46
47
48
49
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class pangram
{
public static void main(String[] args) throws IOException
{
// System.out.println("Input String : ");
try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String S = br.readLine();
S = S.toLowerCase();
S = S.replaceAll("\\s+","");
// System.out.println(S);
int l = S.length();
final Set<Character> remainingLetters = new HashSet<>();
for(char ch='a';ch<='z';ch++)
{
remainingLetters.add(ch);
}
for(int i=0;i<l;i++)
{
remainingLetters.remove(S.charAt(i));
}
if(remainingLetters.isEmpty()==true)
{
System.out.println("pangram");
}
else
{
System.out.println("not pangram");
}
}
catch (Exception e)
{
System.out.println(e);
}
}
}