import Control.Monad
import Control.Applicative
import Data.Array.IArray
import qualified Data.List as L
import Data.Char

type Table = Array (Int, Int) Char

main :: IO ()
main = do
  ss <- map split0 . lines <$> getContents
--  print ss
  mapM_ (print . toChar) ss
--  print table

toChar :: [String] -> String
toChar ss = map (\(i, j) ->
                   if i == 0 then ' '
                   else
                     if j > 3
                     then toUpper (table ! (i, j-3))
                     else (table ! (i, j)) ) ints
  where
    ints :: [(Int, Int)]
    ints =  concatMap (map (\ll ->
                              (read [head ll], length ll)) .
                       L.group) ss
               
split0 = split' (=='0')

split' :: (Char -> Bool) -> String -> [String]
split' p str = go str
  where
    go [] = []
    go ss = (if null ls then "0" else ls) : go (drop 1 rs)
      where
        (ls, rs) = break p ss

table :: Table
table = table' // zip (zip (repeat 1) [1..5]) "',.!?"
  where
    table' = accumArray (\_ c -> c) '1' ((1,1), (9, 5)) ns
    ns = zip [(i, j) |
               i <- [2..9],
               j <- [1..4],
               (i == 7 || i == 9) || (j /= 4)] ['a'..'z']