MCPcopy Create free account
hub / github.com/MohamedMetwalli5/HackerRank-Solutions / Pangrams

Class Pangrams

ProblemSolving (General)/Pangrams.java:9–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import java.util.regex.*;
8
9public class Pangrams {
10
11 // Complete the pangrams function below.
12 static String pangrams(String s) {
13 s = s.toLowerCase();
14 HashSet<Character> h = new HashSet<Character>();
15 for(int i=0;i<s.length();i++){
16 if(Character.isLetter(s.charAt(i))) {
17 h.add(s.charAt(i));
18 }
19 }
20 if(h.size() == 26){
21 return "pangram";
22 }
23 return "not pangram";
24
25 }
26 private static final Scanner scanner = new Scanner(System.in);
27
28 public static void main(String[] args) throws IOException {
29 BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
30
31 String s = scanner.nextLine();
32
33 String result = pangrams(s);
34
35 bufferedWriter.write(result);
36 bufferedWriter.newLine();
37
38 bufferedWriter.close();
39
40 scanner.close();
41 }
42}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected