#!/bin/python3 import sys def issubstr(substr, mystr, start_index=0): try: for letter in substr: start_index = mystr.index(letter, start_index) + 1 print('YES') except: print('NO') myword = 'hackerrank' q = int(input().strip()) for a0 in range(q): s = input().strip() # your code goes here issubstr(myword, s)