String#downcase! will give you
nil, if the string is already in down-cased. So use
String#downcase, it is safe. I am sure, you passed from the command line to the method
gets, a string which is already down-cased. Replace the line
input = gets.chomp.downcase! with
input = gets.chomp.downcase. Now you are safe.
Returns a copy of str with all uppercase letters replaced with their lowercase counterparts. If the receiver string object is already, downcased, then the receiver will be returned.
Downcases the contents of str, returning nil if no changes were made.
One example to demonstrate this -
>> s = "abc"
>> p s.downcase
>> p s.downcase!
nil is an instance of the class
NilClass, which has no instance method called
#include?. So you got
no method error. This is obvious.