We say that a string contains the word hackerrank
if a subsequence of its characters spell the word hackerrank
. Remeber that a subsequence maintains the order of characters selected from a sequence.
More formally, let be the respective indices of h
, a
, c
, k
, e
, r
, r
, a
, n
, k
in string . If is true, then contains hackerrank
.
For each query, print YES
on a new line if the string contains hackerrank
, otherwise, print NO
.
Example
This contains a subsequence of all of the characters in the proper order. Answer YES
This is missing the second 'r'. Answer NO
.
There is no 'c' after the first occurrence of an 'a', so answer NO
.
Function Description
Complete the hackerrankInString function in the editor below.
hackerrankInString has the following parameter(s):
Returns
YES
or NO
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4