# Pangrams Hackerrank problem solution

##### Pangrams Hackerrank

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 s, tell Roy if it is a pangram or not.

Input Format

Input consists of a string s.

Constraints

Length of s can be at most 10Msup>3 and it may contain spaces, lower case and upper case letters. Lower-case and upper-case instances of a letter are considered the same.

Output Format

Output a line containing pangram if s is a pangram, otherwise output not pangram.

Sample Input

Input #1

`We promptly judged antique ivory buckles for the next prize `
Input #2

`We promptly judged antique ivory buckles for the prize `
Sample Output

Output #1

pangram
Output #2

not pangram
Explanation

In the first test case, the answer is pangram because the sentence contains all the letters of the English alphabet.

##### Solution
``````#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {

char s;
while (scanf("%s", &s[strlen(s)]) == 1);
char big = {0};
char small = {0};
for (int i = 0; i < strlen(s); i++) {
if (s[i] >= 'a' && s[i] <= 'z') {
small[s[i] - 'a'] = 1;
}
else if (s[i] >= 'A' && s[i] <= 'Z') {
big[s[i] - 'A'] = 1;
}
}

for (int i = 0; i < 26; i++) {
if (!(big[i] == 1 || small[i] == 1)) {
printf("not pangram");
return 0;
}
}

printf("pangram");

return 0;
}``````
``````from string import lowercase, lower
print ["not pangram", "pangram"][lowercase == ''.join(sorted(list(set(raw_input().lower())-set(' '))))]

# Python 2

from string import lowercase, lower
s = raw_input().lower() # lowercase input
s = list(set(s)-set(' ')) # remove ' ' spaces
s = ''.join(sorted(s)) # joined the sorted list of unique charaters
print ["not pangram", "pangram"][lowercase == s] ``````
```#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main(){
string s;
getline(cin, s);
int cnt;
for(int i =0; i < 26; ++i)
cnt[i] = 0;
for(int i = 0; i < s.length(); ++i){
if(s[i] >= 'a' && s[i] <= 'z'){
cnt[s[i] - 'a']++;
}
if(s[i] >= 'A' && s[i] <= 'Z'){
cnt[s[i] - 'A']++;
}
}
bool f = true;
for(int i = 0; i < 26; ++i){
if(cnt[i] == 0){
f = false;
break;
}
}
if(f){
cout<<"pangram";
}
else{
cout<<"not pangram";
}
return 0;
}```
``````/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Solution
{
public static void main(String[] args) throws java.lang.Exception
{
s = s.toLowerCase();
for (char c = 'a'; c <= 'z'; c++)
{
if (s.indexOf(c) == -1)
{
System.out.println("not pangram");
return;
}
}
System.out.println("pangram");
}
}
``````

### hasectic

A web developer(Front end and Back end), and DBA at csdamu.com. Currently working as Salesforce Developer @ Tech Matrix IT Consulting Private Limited. Check me @about.me/s.saifi