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

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

  map<string, char> e;
  e["00000"] = 'A';
  e["00001"] = 'B';
  e["00010"] = 'C';
  e["00011"] = 'D';
  e["00100"] = 'E';
  e["00101"] = 'F';
  e["00110"] = 'G';
  e["00111"] = 'H';
  e["01000"] = 'I';
  e["01001"] = 'J';
  e["01010"] = 'K';
  e["01011"] = 'L';
  e["01100"] = 'M';
  e["01101"] = 'N';
  e["01110"] = 'O';
  e["01111"] = 'P';
  e["10000"] = 'Q';
  e["10001"] = 'R';
  e["10010"] = 'S';
  e["10011"] = 'T';
  e["10100"] = 'U';
  e["10101"] = 'V';
  e["10110"] = 'W';
  e["10111"] = 'X';
  e["11000"] = 'Y';
  e["11001"] = 'Z';
  e["11010"] = ' ';
  e["11011"] = '.';
  e["11100"] = ',';
  e["11101"] = '-';
  e["11110"] = '\'';
  e["11111"] = '?';
  string str2 = "";
  for(int i = 0; i < str.length(); i++) {
    str2 += d[str[i]];
  }
  int n = 5 - str2.length() % 5;
  for(int i = 0; i < n; i++) {
    str2 += "0";
  }
  string str3;
  for(int i = 0; i < str2.length(); i += 5) {
    str3 += e[str2.substr(i, 5)];
  }
  return str3;
}

int main() {
  string str;
  while(getline(cin, str)) {
    cout << convert(str) << endl;
  }
  return 0;
}