# Here your code ! class String def normalize self.downcase.gsub(/\s/,'Z').gsub(/[^a-zZ]/,'!') end def digi? self =~ /nyo!{0,3}\Z/ end def petit? self =~ /nyu!{0,3}\Z/ end def rabi? self =~ /[Z!]/ end def gema? self =~ /gema!{0,3}\Z/ end def piyo? self =~ /pyo!{0,3}\Z/ end end STDIN.each_line do |line| unless line.downcase =~ /\A(gema|piyo|rabi|petit|digi)\s(.+)\Z/ puts "WRONG!" next end a, v = line.downcase.chomp.split(' ',2) if v.normalize.send("#{a}?".to_sym) puts "CORRECT (maybe)" else puts "WRONG!" end end