table = [
  "", "',.!?", "abcABC", "defDEF", "ghiGHI", "jklJKL",
  "mnoMNO", "pqrsPQRS", "tuvTUV", "wxyzWXYZ"
]

while line = gets
  puts line.chomp.split("").each_with_object([]) { |i, a|
    !a.last.nil? && a.last[0] == i.to_i ? a.last[1] += 1 : a << [i.to_i, 0]
  }.map { |chr, i|
    if chr == 0
      i == 0 ? "" : " " * i
    else
      table[chr][i % table[chr].size]
    end
  }.join
end