#include <iostream>
#include <string>
using namespace std;

string t[26] = 
{
"100101",
"10011010",
"0101",
"0001",
"110",
"01001",
"10011011",
"010000",
"0111",
"10011000",
"0110",
"00100",
"10011001",
"10011110",
"00101",
"111",
"10011111",
"1000",
"00110",
"00111",
"10011100",
"10011101",
"000010",
"10010010",
"10010011",
"10010000"
};

int main()
{
	string line;
	while(getline(cin,line))
	{
		string buf;
		for(int i=0; i<line.size(); i++)
		{
			switch(line[i])
			{
				case ' ' : buf+="101";      break;
				case '\'': buf+="000000";   break;
				case ',' : buf+="000011";   break;
				case '-' : buf+="10010001"; break;
				case '.' : buf+="010001";   break;
				case '?' : buf+="000001";   break;
				default  : buf+=t[line[i]-'A'];break;
			}
		}
		buf+="0000";

		for(int i=0; i<buf.size()-4; i+=5)
		{
			int x = 0;
			for(int j=0; j<5; j++)
			{
				x+= (buf[i+4-j]=='1' ? 1<<j : 0);
			}
			
			char c;
			switch(x)
			{
				case 26: c=' ';  break;
				case 27: c='.';  break;
				case 28: c=',';  break;
				case 29: c='-';  break;
				case 30: c='\''; break;
				case 31: c='?';  break;
				default: c=x+'A';break;
			}

			cout << c;
		}
		cout << endl;
	}
}