#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main(int argc, char *argv[]) {
  string src, tmp, dst;

  while (getline(cin, src)) {
    stringstream ss;
    for (int i = 0; i < src.size(); i++)
      if (src[i] == ' ')
        ss << "101";
      else if (src[i] == '\'')
        ss << "000000";
      else if (src[i] == ',')
        ss << "000011";
      else if (src[i] == '-')
        ss << "10010001";
      else if (src[i] == '.')
        ss << "010001";
      else if (src[i] == '?')
        ss << "000001";
      else if (src[i] == 'A')
        ss << "100101";
      else if (src[i] == 'B')
        ss << "10011010";
      else if (src[i] == 'C')
        ss << "0101";
      else if (src[i] == 'D')
        ss << "0001";
      else if (src[i] == 'E')
        ss << "110";
      else if (src[i] == 'F')
        ss << "01001";
      else if (src[i] == 'G')
        ss << "10011011";
      else if (src[i] == 'H')
        ss << "010000";
      else if (src[i] == 'I')
        ss << "0111";
      else if (src[i] == 'J')
        ss << "10011000";
      else if (src[i] == 'K')
        ss << "0110";
      else if (src[i] == 'L')
        ss << "00100";
      else if (src[i] == 'M')
        ss << "10011001";
      else if (src[i] == 'N')
        ss << "10011110";
      else if (src[i] == 'O')
        ss << "00101";
      else if (src[i] == 'P')
        ss << "111";
      else if (src[i] == 'Q')
        ss << "10011111";
      else if (src[i] == 'R')
        ss << "1000";
      else if (src[i] == 'S')
        ss << "00110";
      else if (src[i] == 'T')
        ss << "00111";
      else if (src[i] == 'U')
        ss << "10011100";
      else if (src[i] == 'V')
        ss << "10011101";
      else if (src[i] == 'W')
        ss << "000010";
      else if (src[i] == 'X')
        ss << "10010010";
      else if (src[i] == 'Y')
        ss << "10010011";
      else if (src[i] == 'Z')
        ss << "10010000";

    tmp = ss.str();
    int piyo = 5 - tmp.size() % 5;
    for (int i = 0; i < piyo; i++)
      tmp += '0';
    //cout << tmp << endl;                                                                                                                                                                                                                                                                                                                          

    for (int i = 0; i < tmp.size(); i+=5) {
      int hoge = 0;
      for (int j = 0; j < 5; j++) {
        hoge *= 2;
        hoge += tmp[i+j]-'0';
      }
      //cout << hoge << endl;                                                                                                                                                                                                                                                                                                                       
      if (0 <= hoge && hoge <= 25)
        dst += ('A'+hoge);
      else if (hoge == 26)
        dst += ' ';
      else if (hoge == 27)
        dst += '.';
      else if (hoge == 28)
        dst += ',';
      else if (hoge == 29)
        dst += '-';
      else if (hoge == 30)
        dst += '\'';
      else if (hoge == 31)
        dst += '?';
    }
    cout << dst << endl;
    dst.clear();
  }
  return 0;
}