Skip to content

Instantly share code, notes, and snippets.

@jasonhejna
Created September 24, 2015 18:26
Show Gist options
  • Save jasonhejna/34b000f32deecc8b63e7 to your computer and use it in GitHub Desktop.
Save jasonhejna/34b000f32deecc8b63e7 to your computer and use it in GitHub Desktop.
var main = {
letterArr: null,
parse: function (_input) {
this.letterArr = _input.toUpperCase().split('');
},
runMyCode: function () {
var asciiLetter = null;
var inputLetter = null;
var j = 0;
if ( this.letterArr.length < 1 || this.letterArr.length > 1000 ) {
throw {
name: 'rangeError',
message: 'input is out of expected range'
};
}
for (i = 65; i <= 90; i++) {
asciiLetter = String.fromCharCode(i);
if ( this.letterArr.indexOf(asciiLetter) === -1 ) {
return 'not pangram';
}
j++;
}
return 'pangram';
}
}
//The following code is mostly from the hackrank example
process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
_input += input;
});
process.stdin.on("end", function () {
main.parse(_input);
var myOutput = main.runMyCode();
process.stdout.write(myOutput);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment