Skip to content

Instantly share code, notes, and snippets.

@ldco2016
Forked from idimitrov07/hackerrank_in_string.rb
Created November 13, 2017 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ldco2016/62d5b8e4174c3bb3599c58dd0052d337 to your computer and use it in GitHub Desktop.
Save ldco2016/62d5b8e4174c3bb3599c58dd0052d337 to your computer and use it in GitHub Desktop.
q = gets.strip.to_i
for a0 in (0..q-1)
s = gets.strip
# your code goes here
# hackerrank
word = ""
index = 0
s.each_char do |c|
if c == "hackerrank"[index]
word += c
index += 1
end
end
puts word == "hackerrank" ? "YES" : "NO"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment