#include<iostream>
#include<string>
#include<map>
using namespace std;
int StoI(string s)
{
	int r=0,i;
	for(i=0;i<s.size();++i)
		r=(r<<1)+s[i]-'0';
	return r;
}
int main()
{
	map<char,string> m1;
	m1[' ']="101";
	m1['\'']="000000";
	m1[',']="000011";
	m1['-']="10010001";
	m1['.']="010001";
	m1['?']="000001";
	m1['A']="100101";
	m1['B']="10011010";
	m1['C']="0101";
	m1['D']="0001";
	m1['E']="110";
	m1['F']="01001";
	m1['G']="10011011";
	m1['H']="010000";
	m1['I']="0111";
	m1['J']="10011000";
	m1['K']="0110";
	m1['L']="00100";
	m1['M']="10011001";
	m1['N']="10011110";
	m1['O']="00101";
	m1['P']="111";
	m1['Q']="10011111";
	m1['R']="1000";
	m1['S']="00110";
	m1['T']="00111";
	m1['U']="10011100";
	m1['V']="10011101";
	m1['W']="000010";
	m1['X']="10010010";
	m1['Y']="10010011";
	m1['Z']="10010000";
	char m2[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
	string s1,s2,s3;
	int i;

	while(getline(cin,s1))
	{
		s2=s3="";
		for(i=0;i<s1.size();++i)
			s2+=m1[s1[i]];
		s2.insert(s2.end(), (5-s2.size()%5)%5, '0');
		for(i=0;i<s2.size();i+=5)
			s3+=m2[ StoI(s2.substr(i,5)) ];
		cout << s3 << endl;
	}
	return 0;
}