enc = {}
enc[" "] = "101"
enc["'"] = "000000"
enc[","] = "000011"
enc["-"] = "10010001"
enc["."] = "010001"
enc["?"] = "000001"
enc["A"] = "100101"
enc["B"] = "10011010"
enc["C"] = "0101"
enc["D"] = "0001"
enc["E"] = "110"
enc["F"] = "01001"
enc["G"] = "10011011"
enc["H"] = "010000"
enc["I"] = "0111"
enc["J"] = "10011000"
enc["K"] = "0110"
enc["L"] = "00100"
enc["M"] = "10011001"
enc["N"] = "10011110"
enc["O"] = "00101"
enc["P"] = "111"
enc["Q"] = "10011111"
enc["R"] = "1000"
enc["S"] = "00110"
enc["T"] = "00111"
enc["U"] = "10011100"
enc["V"] = "10011101"
enc["W"] = "000010"
enc["X"] = "10010010"
enc["Y"] = "10010011"
enc["Z"] = "10010000"

decode_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"
dec = {}
decode_chars.split("").each_with_index{|s, i|
  dec[sprintf("%05d", i.to_s(2))] = s
}

readlines.map(&:chomp).each{|line|
  str = ""
  line.split("").each{|c|
    str += enc[c]
  }
  while str.size % 5 != 0
    str += "0"
  end

  (str.size / 5).times{|i|
    print dec[str[i*5,5]]
  }

  puts
}