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

readlines.each do |l|
  a = ''
  l2 = l.chomp
  l2.each_char do |c|
    a += dic[c]
  end

  if a.length % 5 != 0
    a += "0" * (5 - a.length % 5)
  end

  a2 = a.scan(/.{5}|.+\Z/)

  a2.each do |elem|
    c = ("0b" + elem).oct
    if c < 26 then print (c+65).chr end
    if c == 26
      print ' '
    elsif c == 27
      print '.'
    elsif c == 28
      print ','
    elsif c == 29
      print '-'
    elsif c == 30
      print '\''
    elsif c == 31
      print '?'
    end
  end
  puts
end