#include <bits/stdc++.h>
using namespace std;

/*
int main() {
  string a, b;
  while (cin >> a >> b) {
    cout << "m['" << a << "'] = \"" << b << "\";" << endl;
  }
}
*/

vector<string> split(string s) {
  vector<string> res;
  string t;
  for (int i = 0; i < s.size(); ++i) {
    t += s[i];
    if (t.size() == 5) {
      res.push_back(t);
      t = "";
    }
  }

  return res;
}

int main() {
  string s;
  map<char, string> m;
  map<string, string> t;

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

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

  while (getline(cin, s)) {
    string ss;
    for (int i = 0; i < s.size(); ++i) {
      ss += m[s[i]];
    }

    if (ss.size() % 5) ss += string(5 - (int)ss.size() % 5, '0');
    vector<string> v = split(ss);
    for (int i = 0; i < v.size(); ++i) {
      cout << t[v[i]];
    }
    puts("");
  }
}