#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
map<char,string> table;
map<string,char> table2;

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

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.the_code_a_doctor_loved", "r", stdin );
	make_table();
	string str = "";
	while (getline (cin, str ) ){
		int n = str.length();
		string ans = "";
		rep (i, n ){
			ans += table[str[i]];
		} // end rep
		if (ans.length() % 5 != 0 ){
			ans += string (5 - (ans.length() % 5 ), '0' );
		} // end if
		string res = "";
		for (int i = 0; i < ans.length(); i += 5 ){
			 res += table2[ans.substr (i, 5 )];
		} // end for
		cout << res << endl;
	} // end loop
		
	return 0;
}