import Foundation let hackerrank = "hackerrank" var strings: [String] = [] let n = Int(readLine()!)! for _ in 0 ..< n { let str = readLine()! strings.append(str) } for var str in strings { var found = true for character in hackerrank.characters { if !found { break } // check if character is found let index = str.characters.index(of: character) if let index = index { let startingIndex = str.index(index, offsetBy: 1) str = str.substring(from: startingIndex) } else { found = false } } if found { print("YES") } else { print("NO") } }