프로그래밍/HackerRank
[HackerRank][Python3] HackerRank in a String!
snoopybox
2018. 9. 3. 23:40
Problem :
https://www.hackerrank.com/challenges/hackerrank-in-a-string/problem
My Solution :
#!/usr/bin/env python3
def hackerrank_in_string(s):
word = 'hackerrank'
i = j = 0
while i < len(word) and j < len(s):
if word[i] == s[j]:
i += 1
j += 1
if i == len(word):
return 'YES'
return 'NO'
q = int(input())
for _ in range(q):
s = input()
result = hackerrank_in_string(s)
print(result)