o = 'abcdefghijklmnopqrstuvwxyz' s = gets oa = o.split('') sa = s.split('') from = (oa - sa)[0] i = from.ord - 'a'.ord to = s[i] puts "#{from}to#{to}"