while s = gets s = s.split(' ') case s[0] when "digi" if s[s.size - 1] =~ /.*nyo[\W_]{0,3}/i puts "CORRECT (maybe)" else puts "WRONG!" end when "petit" if s[s.size - 1] =~ /.*nyu[\W_]{0,3}/i puts "CORRECT (maybe)" else puts "WRONG!" end when "rabi" f = false (1...s.size).each do |i| f = true if s[i] =~ /.*[a-zA-Z0-9]+.*/ end if f puts "CORRECT (maybe)" else puts "WRONG!" end when "gema" f = true (1...s.size).each do |i| f = false if s[i] =~ /.*gema[\W_]{0,3}/i end if f puts "CORRECT (maybe)" else puts "WRONG!" end else f = true (1...s.size).each do |i| f = false if s[i] =~ /.*pyo[\W_]{0,3}/i end if f puts "CORRECT (maybe)" else puts "WRONG!" end end end