#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  map<char,string> enc;
  map<string,char> dec;

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

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

  string input;
  while(getline(cin, input)){
    string buff = "";
    REP(i, input.size()){
      buff+=enc[input[i]];
      while(buff.size() >= 5){
	string tmp = buff.substr(0,5);
	buff = buff.substr(5);
	cout << dec[tmp];
      }
    }
    if(buff.size() != 0){
      while(buff.size() != 5) buff += "0";
      cout << dec[buff];
    }

    cout << endl;
  }
  return 0;
}