#include<iostream>
#include<string>
using namespace std;
int ctoi(char ch);
string code(char ch);
char decode(string substr);

int ctoi(char ch){
	return ch-'0';
}
string code(char ch){
	string str;
	switch(ch){
		case ' ': return str="101";
		case '\'': return str="000000";
		case '\,': return str="000011";
		case '\-': return str="10010001";
		case '\.': return str="010001";
		case '\?': return str="000001";
		
		case 'A': return str="100101";
		case 'B': return str="10011010";
		case 'C': return str="0101";
		case 'D': return str="0001";
		case 'E': return str="110";
		case 'F': return str="01001";
		case 'G': return str="10011011";
		
		case 'H': return str="010000";
		case 'I': return str="0111";
		case 'J': return str="10011000";
		case 'K': return str="0110";
		case 'L': return str="00100";
		case 'M': return str="10011001";
		case 'N': return str="10011110";
		
		case 'O': return str="00101";
		case 'P': return str="111";
		case 'Q': return str="10011111";
		case 'R': return str="1000";
		case 'S': return str="00110";
		case 'T': return str="00111";
		case 'U': return str="10011100";
		
		case 'V': return str="10011101";
		case 'W': return str="000010";
		case 'X': return str="10010010";
		case 'Y': return str="10010011";
		case 'Z': return str="10010000";
		
	}
	return str;
}
char decode(string substr){
	int strnum=0;
	strnum+=16*ctoi(substr[0]);
	strnum+=8*ctoi(substr[1]);
	strnum+=4*ctoi(substr[2]);
	strnum+=2*ctoi(substr[3]);
	strnum+=1*ctoi(substr[4]);
	if(strnum + 'A' <= 'Z' )
		return char(strnum + 'A');
	else{
		switch(strnum){
			case 'Z'-'A'+1: return ' ';
			case 'Z'-'A'+2: return '\.';
			case 'Z'-'A'+3: return '\,';
			case 'Z'-'A'+4: return '\-';
			case 'Z'-'A'+5: return '\'';
			case 'Z'-'A'+6: return '\?';
		}
	}
	return 0;
}

int main(){
	string str1, str2, str3;
	int i, j;
	while(getline(cin,str1)){
		str2.erase();
		str3.erase();
		for(i=0;i<str1.size();i++){
			str2 += code(str1[i]);
		}
		for(i=str2.size() % 5; i<5;i++){
			str2 +="0";
		}
		for(i=0;i<str2.size();i+=5){
			//cout<<str2.substr(i, 5)<<" ";
			str3+=decode(str2.substr(i, 5));
		}
		cout<<str3<<endl;
	}
	return 0;
}