#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int n;
int main(){
	map<char,string>in;
	in[' ']="101";
	in['\'']="000000";
	in[',']="000011";
	in['-']="10010001";
	in['.']="010001";
	in['?']="000001";
	in['A']="100101";
	in['B']="10011010";
	in['C']="0101";
	in['D']="0001";
	in['E']="110";
	in['F']="01001";
	in['G']="10011011";
	in['H']="010000";
	in['I']="0111";
	in['J']="10011000";
	in['K']="0110";
	in['L']="00100";
	in['M']="10011001";
	in['N']="10011110";
	in['O']="00101";
	in['P']="111";
	in['Q']="10011111";
	in['R']="1000";
	in['S']="00110";
	in['T']="00111";
	in['U']="10011100";
	in['V']="10011101";
	in['W']="00010";
	in['X']="10010010";
	in['Y']="10010011";
	in['Z']="10010000";
	map<string,char>out;
	out["00000"]='A';
	out["00001"]='B';
	out["00010"]='C';
	out["00011"]='D';
	out["00100"]='E';
	out["00101"]='F';
	out["00110"]='G';
	out["00111"]='H';
	out["01000"]='I';
	out["01001"]='J';
	out["01010"]='K';
	out["01011"]='L';
	out["01100"]='M';
	out["01101"]='N';
	out["01110"]='O';
	out["01111"]='P';
	out["10000"]='Q';
	out["10001"]='R';
	out["10010"]='S';
	out["10011"]='T';
	out["10100"]='U';
	out["10101"]='V';
	out["10110"]='W';
	out["10111"]='X';
	out["11000"]='Y';
	out["11001"]='Z';
	out["11010"]=' ';
	out["11011"]='.';
	out["11100"]=',';
	out["11101"]='-';
	out["11110"]='\'';
	out["11111"]='?';
	string s;
	while(getline(cin,s)){
		string a="";
		rep(i,s.size())a+=in[s[i]];
		while(a.size()%5)a+='0';
		rep(i,a.size()/5)cout<<out[a.substr(i*5,5)];
		cout<<endl;
	}
}