#include<cstdio>
#include<string>
#include<cstring>

using namespace std;

void code2str(const string& before,string& after);
void char2code(char ch,string& after);


int main()
{
	char ch;
	string code,str;
	bool flg=true;
	for(;;)
	{
		for(;;)
		{
			ch=getchar();
			if(ch==EOF)
			{
				flg=false;
				break;
			}
			if(ch=='\n')
			{
				break;
			}
			char2code(ch,code);
		}
		if(!flg)break;
		code2str(code,str);
		puts(str.c_str());
	}
	return 0;
}

void char2code(char ch,string& after)
{
	switch(ch)
	{
	case ' ':
		after+="101";
		break;
	case '\'':
		after+="000000";
		break;
	case ',':
		after+="000011";
		break;
	case '-':
		after+="1001001";
		break;
	case '.':
		after+="010001";
		break;
	case '?':
		after+="000001";
		break;
	case 'A':
		after+="100101";
		break;
	case 'B':
		after+="10011010";
		break;
	case 'C':
		after+="0101";
		break;
	case 'D':
		after+="0001";
		break;
	case 'E':
		after+="110";
		break;
	case 'F':
		after+="01001";
		break;
	case 'G':
		after+="10011011";
		break;
	case 'H':
		after+="010000";
		break;
	case 'I':
		after+="0111";
		break;
	case 'J':
		after+="10011000";
		break;
	case 'K':
		after+="0110";
		break;
	case 'L':
		after+="00100";
		break;
	case 'M':
		after+="10011001";
		break;
	case 'N':
		after+="10011110";
		break;
	case 'O':
		after+="00101";
		break;
	case 'P':
		after+="111";
		break;
	case 'Q':
		after+="10011111";
		break;
	case 'R':
		after+="1000";
		break;
	case 'S':
		after+="00110";
		break;
	case 'T':
		after+="00111";
		break;
	case 'U':
		after+="10011100";
		break;
	case 'V':
		after+="10011101";
		break;
	case 'W':
		after+="000010";
		break;
	case 'X':
		after+="10010010";
		break;
	case 'Y':
		after+="10010011";
		break;
	case 'Z':
		after+="1001000";
		break;
	}
}

void code2str(const string& before,string& after)
{
	string code;
	for(int i=0;i<before.size();i+=5)
	{
		code="";
		for(int j=0;j<5;j++)
		{
			if(i+j<before.size())
			{
				code+=before[i+j];
			}
			else
			{
				code+='0';
			}
		}
		if(code=="00000")
		{
			after+='A';
		}
		else if(code=="00001")
		{
			after+='B';
		}
		else if(code=="00010")
		{
			after+='C';
		}
		else if(code=="00011")
		{
			after+='D';
		}
		else if(code=="00100")
		{
			after+='E';
		}
		else if(code=="00101")
		{
			after+='F';
		}
		else if(code=="00110")
		{
			after+='G';
		}
		else if(code=="00111")
		{
			after+='H';
		}
		else if(code=="01000")
		{
			after+='I';
		}
		else if(code=="01001")
		{
			after+='J';
		}
		else if(code=="01010")
		{
			after+='K';
		}
		else if(code=="01011")
		{
			after+='L';
		}
		else if(code=="01100")
		{
			after+='M';
		}
		else if(code=="01101")
		{
			after+='N';
		}
		else if(code=="01110")
		{
			after+='O';
		}
		else if(code=="01111")
		{
			after+='P';
		}
		else if(code=="10000")
		{
			after+='Q';
		}
		else if(code=="10001")
		{
			after+='R';
		}
		else if(code=="10010")
		{
			after+='S';
		}
		else if(code=="10011")
		{
			after+='T';
		}
		else if(code=="10100")
		{
			after+='U';
		}
		else if(code=="10101")
		{
			after+='V';
		}
		else if(code=="10110")
		{
			after+='W';
		}
		else if(code=="10111")
		{
			after+='X';
		}
		else if(code=="11000")
		{
			after+='Y';
		}
		else if(code=="11001")
		{
			after+='Z';
		}
		else if(code=="11010")
		{
			after+=' ';
		}
		else if(code=="11011")
		{
			after+='.';
		}
		else if(code=="11100")
		{
			after+=',';
		}
		else if(code=="11101")
		{
			after+='-';
		}
		else if(code=="11110")
		{
			after+='\'';
		}
		else if(code=="11111")
		{
			after+='?';
		}
	}
}