def word_numbers(input)
  digit_map = {
    '0' => ["0"],
    '1' => ["1"],
    '2' => ["a", "b", "c"],
    '3' => ["d", "e", "f"],
    '4' => ["g", "h", "i"],
    '5' => ["j", "k", "l"],
    '6' => ["m", "n", "o"],
    '7' => ["p", "q", "r", "s"],
    '8' => ["t", "u", "v"],
    '9' => ["w", "x", "y", "z"]
  }

  rs = [""]
  tmp = [""]

  input.split("").each do |char|
    letters = digit_map[char]

    rs.each_with_index do |current_val, index|
      ret_index = tmp.index(current_val)
      add_items = []

      letters.each_with_index do |letter, letter_index|
        new_value = current_val + letter
        if letter_index == 0
          tmp[ret_index] = new_value
        else
          add_items << new_value
        end
      end

      if add_items.length > 0
        tmp.insert(ret_index+1, *add_items)
      end
    end
    rs = nil
    rs = tmp.dup
  end
  return rs
end

puts "What is your phone numbers ?"
phone = gets.chomp

if phone.length != 8
  puts "ERROR"
else
  puts word_numbers(phone)
end
