#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;


map<string,string> bef;
map<string,string> aft;


int main(){
	bef[" "]="101";
	bef["'"]="000000";   bef[","]="000011";   bef["-"]="10010001";
	bef["."]="010001";   bef["?"]="000001";   bef["A"]="100101";
	bef["B"]="10011010";   bef["C"]="0101";   bef["D"]="0001";
	bef["E"]="110";   bef["F"]="01001";   bef["G"]="10011011";
	bef["H"]="010000";   bef["I"]="0111";   bef["J"]="10011000";
	bef["K"]="0110";   bef["L"]="00100";   bef["M"]="10011001";
	bef["N"]="10011110";   bef["O"]="00101";   bef["P"]="111";
	bef["Q"]="10011111";   bef["R"]="1000";   bef["S"]="00110";
	bef["T"]="00111";   bef["U"]="10011100";   bef["V"]="10011101";
	bef["W"]="000010";   bef["X"]="10010010";   bef["Y"]="10010011";
	bef["Z"]="10010000";
	
	aft["00000"]="A";
	aft["00001"]="B";  aft["00010"]="C";  aft["00011"]="D";
	aft["00100"]="E";  aft["00101"]="F";  aft["00110"]="G";
	aft["00111"]="H";  aft["01000"]="I";  aft["01001"]="J";
	aft["01010"]="K";  aft["01011"]="L";  aft["01100"]="M";
	aft["01101"]="N";  aft["01110"]="O";  aft["01111"]="P";
	aft["10000"]="Q";  aft["10001"]="R";  aft["10010"]="S";  aft["10011"]="T";
	aft["10100"]="U";  aft["10101"]="V";  aft["10110"]="W";
	aft["10111"]="X";  aft["11000"]="Y";  aft["11001"]="Z";
	aft["11010"]=" ";  aft["11011"]=".";  aft["11100"]=",";
	aft["11101"]="-";  aft["11110"]="'";  aft["11111"]="?";
	
	string s1;
	string s2;
	string s3;
	string t;
	while(getline(cin,s1)){
		s2.clear();
		rep(i,s1.size()){
			t=s1[i];
			s2+=bef[t];
		}
		//cout<<s2.size()<<endl;
		while(s2.size()%5!=0) s2+="0";
		//cout<<s2<<endl;
		s3.clear();
		for(int i=0;i<s2.size();i+=5){
			s3+=aft[s2.substr(i,5)];
		}
		cout<<s3<<endl;
	}
	return 0;
}