#include <bits/stdc++.h>

using namespace std;

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

	P[32]="101";
	P[39]="000000";
	P[44]="000011";
	P[45]="10010001";
	P[46]="010001";
	P[63]="000001";
	P[65]="100101";//A
	P[66]="10011010";
	P[67]="0101";
	P[68]="0001";
	P[69]="110";
	P[70]="01001";
	P[71]="10011011";
	P[72]="010000";
	P[73]="0111";
	P[74]="10011000";
	P[75]="0110";
	P[76]="00100";
	P[77]="10011001";
	P[78]="10011110";
	P[79]="00101";
	P[80]="111";
	P[81]="10011111";
	P[82]="1000";
	P[83]="00110";
	P[84]="00111";
	P[85]="10011100";
	P[86]="10011101";
	P[87]="000010";
	P[88]="10010010";
	P[89]="10010011";
	P[90]="10010000";

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

	string str;
	while(getline(cin,str))
	{
		int count=0;
		string set_str;
		string keep;
		string ans_str;

		for(int i=0;i<str.length();i++)
		{
			set_str += P[str[i]];
		}

		while(set_str.length()%5)set_str+='0';

		for(int i=0;i<set_str.length();i++)
		{
			ans_str += set_str[i];
			count++;
			if(!(count%5) && count)
			{
				cout << PP[ans_str];
				ans_str.erase(ans_str.begin(),ans_str.end());
			}
		}
		cout << endl;
	}
	
	return 0;
}