while str = gets do str = str.match(/(\w+) (.*)/) case str[1] when "digi" then if /nyo[^a-zA-Z0-9]{0,3}$/i =~ str[2] then puts "CORRECT (maybe)" else puts "WRONG!" end when "petit" then if /nyu[^a-zA-Z0-9]{0,3}$/i =~ str[2] then puts "CORRECT (maybe)" else puts "WRONG!" end when "rabi" then if /[a-zA-Z0-9]/i =~ str[2] then puts "CORRECT (maybe)" else puts "WRONG!" end when "gema" then if /gema[^a-zA-Z0-9]{0,3}$/i =~ str[2] then puts "CORRECT (maybe)" else puts "WRONG!" end when "piyo" then if /pyo[^a-zA-Z0-9]{0,3}$/i =~ str[2] then puts "CORRECT (maybe)" else puts "WRONG!" end end end