Last active
August 17, 2016 13:01
-
-
Save arsho/68b9b6ffbfc382ae643d65011d09f479 to your computer and use it in GitHub Desktop.
Pangrams problem from https://www.hackerrank.com/challenges/pangrams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_fp = fopen("php://stdin", "r"); | |
while($line=fgets($_fp)){ | |
$line = strtolower($line); | |
$line_length = strlen($line); | |
$char_ar=array(); | |
for ($i=0;$i<$line_length;$i++){ | |
$current_char = $line[$i]; | |
if(preg_match('/^[a-z]$/',$current_char)){ | |
$char_ar[$current_char] = 1; | |
} | |
if(count($char_ar)==26) { | |
break; | |
} | |
} | |
if(count($char_ar)==26){ | |
echo "pangram"; | |
} | |
else{ | |
echo "not pangram"; | |
} | |
} | |
fclose($_fp); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python Solution