#K37572. Can Jordan Win?
Can Jordan Win?
Can Jordan Win?
Jordan is preparing for a challenge where he must complete the sequence "win" using a series of moves. However, the letters in the sequence do not need to be consecutive; they only have to appear in order as a subsequence of the given moves string.
Your task is to check whether the given string of moves contains the subsequence win. For example, if the moves string is wdziein
, then Jordan can obtain "win" by selecting the letters 'w', 'i', and 'n' in order, so the answer should be YES. Otherwise, output NO.
Note: A subsequence is a sequence that appears in the same order, but not necessarily consecutively. In mathematical terms, given a string \( S \) and a target sequence \( T = win \), there exists indices \( 1 \leq i_1 < i_2 < i_3 \leq |S| \) such that \( S[i_1] = w \), \( S[i_2] = i \), and \( S[i_3] = n \) if and only if Jordan can win.
inputFormat
The input consists of a single line containing a string of lowercase letters, representing the moves made.
Input is provided via standard input (stdin).
outputFormat
Output YES
if the string contains "win" as a subsequence; otherwise, output NO
.
The output should be printed to standard output (stdout).
## samplewdziein
YES