#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

map<char, string> mp;
map<string, char> mp2;

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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  init();
  string s;
  while (getline(cin, s)) {
    string t = "";
    for (int i = 0; i < (int)s.size(); i++) {
      t += mp[s[i]];
    }
    while ((int)t.size() % 5 != 0) t += "0";
    string ans = "";
    for (int i = 0; i < (int)t.size(); i += 5) {
      ans += mp2[t.substr(i, 5)];
    }
    cout << ans << endl;
  }

  return 0;
}
