-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPangrams.java
More file actions
32 lines (29 loc) · 802 Bytes
/
Copy pathPangrams.java
File metadata and controls
32 lines (29 loc) · 802 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
package com.pangrams;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Pangrams {
public static void main(String[] args) throws IOException {
BufferedReader buffer = new BufferedReader(new FileReader(args[0]));
String line = "";
while((line = buffer.readLine()) != null) {
System.out.println(pangram(line));
}
buffer.close();
}
private static String pangram(String line) {
String result = "";
String alphabets = "abcdefghijklmnopqrstuvwxyz";
int length = alphabets.length();
for (int counter = 0; counter < length; counter++) {
String alphabet = alphabets.charAt(counter) + "";
if (!line.contains(alphabet)) {
result += alphabet;
}
}
if(result.isEmpty()) {
return "NULL";
}
return result;
}
}