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

gyaku = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"

while s=gets
  s=s.chomp
  t=""
  for i in 0...s.length
    t+=mp[s[i]]
  end
  n = t.length
  t += "0"*((5-n%5)%5)
  n = t.length
  res = ""
  for i in 0...(n/5)
    beg = i*5
    id = 0
    for j in 0...5
      id*=2
      id+=(t[beg+j]=="0" ? 0 : 1)
    end
    res += gyaku[id]
  end
  puts res
end