#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;

string change1(string s){
  map<char, string> p;
  p[' '] = "101";
  p['\''] = "000000";
  p[','] = "000011";
  p['~'] = "10010001";
  p['.'] = "010001";
  p['?'] = "000001";
  p['A'] = "100101";
  p['B'] = "10011010";
  p['C'] = "0101";
  p['D'] = "0001";
  p['E'] = "110";
  p['F'] = "01001";
  p['G'] = "10011011";
  p['H'] = "010000";
  p['I'] = "0111";
  p['J'] = "10011000";
  p['K'] = "0110";
  p['L'] = "00100";
  p['M'] = "10011001";
  p['N'] = "10011110";
  p['O'] = "00101";
  p['P'] = "111";
  p['Q'] = "10011111";
  p['R'] = "1000";
  p['S'] = "00110";
  p['T'] = "00111";
  p['U'] = "10011100";
  p['V'] = "10011101";
  p['W'] = "000010";
  p['X'] = "10010010";
  p['Y'] = "10010011";
  p['Z'] = "10010000";
  string res = "";
  for(int i = 0 ; i < s.size() ; i++) res += p[s[i]];
  while(res.size() % 5 != 0) res += '0';
  return res;
}

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

int main(){
  string s;
  while(getline(cin, s)){
    s = change1(s);
    s = change2(s);
    cout << s << endl;
  }
  return 0;
}