Debugging the Punch Tape

Company: codechef_18thjuly

Difficulty: easy

Problem Statement

Debugging the Punch Tape Problem Description Early computer engineers once traced a machine failure to a real moth stuck inside a relay, and the word "debugging" stuck with it. Grace now checks reels of punch tape for the same kind of bug. Each reel is written as a string S made of English letters. A reel is buggy when the four letters m , o , t , h appear in S next to each other and in exactly that order, that is, when S contains moth as a contiguous substring. Upper and lower case are treated as the same letter, so moth , MOTH , Moth and mOtH all count as a bug. For every reel, decide whether it is buggy. Complete the function solve(s) , which receives one reel s and returns the string YES if it is buggy and NO otherwise. Input Format Read from standard input. T S_1 S_2 ... S_T Line 1 contains the integer T , the number of reels. Each of the next T lines contains one string S_i , the reel for test case i . Output Format Print T lines. Line i contains YES if S_i is buggy and NO otherw