#include <iostream>
#include <string>
#include <map>
#include <sstream>
using namespace std;

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

  map<string, char> s2c;
  s2c["00000"] = 'A';
  s2c["00001"] = 'B';
  s2c["00010"] = 'C';
  s2c["00011"] = 'D';
  s2c["00100"] = 'E';
  s2c["00101"] = 'F';
  s2c["00110"] = 'G';
  s2c["00111"] = 'H';
  s2c["01000"] = 'I';
  s2c["01001"] = 'J';
  s2c["01010"] = 'K';
  s2c["01011"] = 'L';
  s2c["01100"] = 'M';
  s2c["01101"] = 'N';
  s2c["01110"] = 'O';
  s2c["01111"] = 'P';
  s2c["10000"] = 'Q';
  s2c["10001"] = 'R';
  s2c["10010"] = 'S';
  s2c["10011"] = 'T';
  s2c["10100"] = 'U';
  s2c["10101"] = 'V';
  s2c["10110"] = 'W';
  s2c["10111"] = 'X';
  s2c["11000"] = 'Y';
  s2c["11001"] = 'Z';
  s2c["11010"] = ' ';
  s2c["11011"] = '.';
  s2c["11100"] = ',';
  s2c["11101"] = '-';
  s2c["11110"] = '\'';
  s2c["11111"] = '?';

  string s;
  while (getline(cin, s)) {
    string e1 = "";
    for (unsigned int i = 0; i < s.size(); ++i) {
      if (c2s.find(s[i]) != c2s.end())
	e1 += c2s[s[i]];
    }

    int add_zero = 5 - e1.size()%5;
    for (int i = 0; i < add_zero; ++i)
      e1 += "0";

    string e2 = "";
    for (int i = 0; i < e1.size(); i += 5)
      e2 += s2c[e1.substr(i, 5)];
    cout << e2 << endl;
  }
  return 0;
}