#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

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

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

	return 0;
}