Thank you for help, it’s strange but this code is…valid.
Before to post I’ve tested it ten of time and it was only two string, but this morning I ran code again and it all ok
But anyway, thanks for help.
The strip is important though after gets. Try it by entering different search strings, like “lin” or “st”: without strip you won’t get any matches, but with strip you will.
See this irb session:
$ irb
2.7.2 :001 > a = gets
line
=> "line\n"
2.7.2 :002 > b = gets.strip
line
=> "line"