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

string to[] = {"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","101","000000","000011","10010001","010001","000001"};

int main(){
	string s;
	map<char,string> tm;
	map<string,char> fm;
	for(int i = 0;i < 26;i++){
		tm[i + 'A'] = to[i];
		string tmp = "";
		for(int j = 4;j >= 0;j--) tmp += to_string((i >> j) & 1);
		fm[tmp] = i + 'A';
	}
	tm[' '] = to[26];
	tm['\''] = to[27];
	tm[','] = to[28];
	tm['-'] = to[29];
	tm['.'] = to[30];
	tm['?'] = to[31];
	fm["11010"] = ' ';
	fm["11011"] = '.';
	fm["11100"] = ',';
	fm["11101"] = '-';
	fm["11110"] = '\'';
	fm["11111"] = '?';
	while(getline(cin,s)){
		string t = "";
		for(int i = 0;i < s.length();i++) t += tm[s[i]];
		for(int i = (t.length() + 4) % 5 + 1;i < 5;i++) t += "0";
		for(int i = 0;i < t.length() / 5;i++) cout << fm[t.substr(i * 5,5)];
		cout << endl;
	}
	return 0;
}