#include <iostream>
#include <string>
using namespace std;
int main(){
	string a,b,c;
	int sma;
	string d="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
	while(getline(cin,a)){
		b="";
		c="";
		for(int i=0;i<a.size();i++){
			if(a[i]==' ')b+="101";
			else if(a[i]==39)b+="000000";
			else if(a[i]==',')b+="000011";
			else if(a[i]=='-')b+="10010001";
			else if(a[i]=='.')b+="010001";
			else if(a[i]=='?')b+="000001";
			else if(a[i]=='A')b+="100101";
			else if(a[i]=='B')b+="10011010";
			else if(a[i]=='C')b+="0101";
			else if(a[i]=='D')b+="0001";
			else if(a[i]=='E')b+="110";
			else if(a[i]=='F')b+="01001";
			else if(a[i]=='G')b+="10011011";
			else if(a[i]=='H')b+="010000";
			else if(a[i]=='I')b+="0111";
			else if(a[i]=='J')b+="10011000";
			else if(a[i]=='K')b+="0110";
			else if(a[i]=='L')b+="00100";
			else if(a[i]=='M')b+="10011001";
			else if(a[i]=='N')b+="10011110";
			else if(a[i]=='O')b+="00101";
			else if(a[i]=='P')b+="111";
			else if(a[i]=='Q')b+="10011111";
			else if(a[i]=='R')b+="1000";
			else if(a[i]=='S')b+="00110";
			else if(a[i]=='T')b+="00111";
			else if(a[i]=='U')b+="10011100";
			else if(a[i]=='V')b+="10011101";
			else if(a[i]=='W')b+="000010";
			else if(a[i]=='X')b+="10010010";
			else if(a[i]=='Y')b+="10010011";
			else if(a[i]=='Z')b+="10010000";
		}
		while(b.size()%5!=0)b+='0';
		for(int i=0;i<b.size();i+=5){
			sma=(16*(b[i]-'0'))+(8*(b[i+1]-'0'))+(4*(b[i+2]-'0'))+(2*(b[i+3]-'0'))+(1*(b[i+4]-'0'));
			c+=d[sma];
			
		}
		cout<<c<<endl;
		
	}
	
	return 0;
}
