Skip to content

Instantly share code, notes, and snippets.

@breakstorm
Created May 22, 2017 12:04
Show Gist options
  • Save breakstorm/65b96c4258e44dc1683068e776f7caaf to your computer and use it in GitHub Desktop.
Save breakstorm/65b96c4258e44dc1683068e776f7caaf to your computer and use it in GitHub Desktop.
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
process.stdin.on('end', function () {
input_stdin_array = input_stdin.split("\n");
main();
});
function readLine() {
return input_stdin_array[input_currentline++];
}
/////////////// ignore above this line ////////////////////
function contain(diff, base){
// console.log(diff);
// console.log(base);
var j =0;
for(var i =0; i < diff.length; i++){
if(diff[i] === base[j]){
j++;
}
}
if(base.length === j){
return true;
}else{
return false;
}
}
function main() {
var q = parseInt(readLine());
var base = 'hackerrank'.split("");
for(var a0 = 0; a0 < q; a0++){
var s = readLine();
var temp = s.split("");
var result = contain(temp, base);
console.log(result === true ? "YES" : "NO");
// your code goes here
}
//기준배열을 만든다.
//기준배열을 순회하면 비교대상에 값이 있는지 찾는다.
//값이 있을경우 -> 해당 갑을 삭제한다.
//값이 없을경우 -> 함수를 종료한다. NO를 출력한다.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment