def search(s, t) for i in 0 .. 3 if s[-t.size-i..-1-i] == t return true end end false end while s = gets.chomp if s == "" exit 0 end cor = false if s[0..4] == "digi " ok = search(s.downcase, "nyo") end if s[0..5] == "petit " ok = search(s.downcase, "nyu") end if s[0..4] == "gema " ok = search(s.downcase, "gema") end if s[0..4] == "piyo " ok = search(s[5..-1].downcase, "pyo") end if s[0..4] == "rabi " t = s[5..-1].downcase for k in t if ('0' <= k && k <= '9') || ('a' <= k && k <= 'z') ok = true end end end puts (ok ? "CORRECT (maybe)" : "WRONG!") end