#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

string convert(string str){
  string res = "";
  map<char, string>s;
  s[' '] = "101";
  s['\''] = "000000";
  s[','] = "000011";
  s['-'] = "10010001";
  s['.'] = "100101";
  s['?'] = "000001";
  s['A'] = "100101";
  s['B'] = "10011010";
  s['C'] = "0101";
  s['D'] = "0001";
  s['E'] = "110";
  s['F'] = "01001";
  s['G'] = "100110011";
  s['H'] = "010000";
  s['I'] = "0111";
  s['J'] = "10011000";
  s['K'] = "0110";
  s['L'] = "00100";
  s['M'] = "10011001";
  s['N'] = "0011110";
  s['O'] = "00101";
  s['P'] = "111";
  s['Q'] = "10011111";
  s['R'] = "1000";
  s['S'] = "00110";
  s['T'] = "00111";
  s['U'] = "0011100";
  s['V'] = "0011101";
  s['W'] = "000010";
  s['X'] = "010010";
  s['Y'] = "0010011";
  s['Z'] = "0010000";

  rep(i, str.length()){
    res += s[str[i]];
  }

  while(res.size() % 5) res += "0";
 
  return res;
}

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

  for(int i = 0; i < str.length(); i += 5){
    string f; // = string(str[i] + str[i+1] + str[i+2] + str[i+3] + str[i+4]);
    f = str[i]; f += str[i+1]; f+= str[i+2]; f += str[i+3]; f += str[i+4];
    res += s[f];
  }
  return res;
}

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