#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

string c1[128];
char c2[100];

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

  for(int i = 0; i < 26; ++i) c2[i] = 'A' + i;
  c2[31] = '?';
  c2[30] = '\'';
  c2[29] = '-';
  c2[28] = ',';
  c2[27] = '.';
  c2[26] = ' ';

  string s;
  while(getline(cin, s)) {
    string t;
    for(int i = 0; i < s.size(); ++i) {
      t += c1[s[i]];
    }
    while(t.size()%5 != 0) t += "0";
    for(int i = 0; i < t.size(); i += 5) {
      string u = t.substr(i,5);
      reverse(u.begin(), u.end());
      int v = 0;
      for(int j = 0; j < u.size(); ++j) {
        if(u[j] == '1') v += (1<<j);
      }
      cout << c2[v];
    }
    cout << endl;
  }
  return 0;
}