less than 1 minute read

Pangrams (Hacker Rank)

Roy wanted to increase his typing speed for programming contests. So, his friend advised him to type the sentence “The quick brown fox jumps over the lazy dog” repeatedly, because it is a pangram. (Pangrams are sentences constructed by using every letter of the alphabet at least once.)

After typing the sentence several times, Roy became bored with it. So he started to look for other pangrams.

Given a sentence , tell Roy if it is a pangram or not.

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
    public static void main(String args[] ) throws Exception {
        Scanner s  = new Scanner(System.in);
        String str = s.nextLine();
        str = str.toLowerCase();
        String result = "pangram";
        if(str.length() < 26){
            result  = "not pangram";
        }else{
            for(char c = 'a'; c <= 'z'; c++){
                if(!str.matches(".*"+c+".*")){
                    result = "not pangram";
                }
            }
        }
        System.out.println(result);
    }
}
행운의 77문제 프로젝트
  행운의 77문제 프로젝트는 한 달동안 알고리즘 문제 77개를 푸는 프로젝트입니다.