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

string encode(char c){
	string a[]={"101","000000","000011","10010001","010001","000001","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"};
	static const string str=" \',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(int i=0;i<str.length();i++){
		if(c==str[i])return a[i];
	}
}

char decode(string s){
	string str2="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-\'?";
	std::bitset<5> b(s);
	return str2[b.to_ulong()];
}

int main(void){

	string s;
	string code="";

	while (std::getline(cin,s)) {
		string code="";
		for(int i=0;i<s.length();i++) code+=encode(s[i]);
		string retu="";
		code+="0000";
		for(int i=0;i+5<code.length();i+=5){
			string dd=code.substr(i,5);
			retu+=decode(dd);
		}
		cout<<retu<<endl;
	}
	return 0;
}