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

int index(char c){
	if(c == ' ') return 26;
	if(c == '\'') return 27;
	if(c == ',') return 28;
	if(c == '-') return 29;
	if(c == '.') return 30;
	if(c == '?') return 31;
	return (int)c - (int)'A';
}

string coder[] = {
	"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"
};

char uncoder[] = {
	'A', 'B', 'C', 'D',
	'E', 'F', 'G', 'H',
	'I', 'J', 'K', 'L',
	'M', 'N', 'O', 'P',
	'Q', 'R', 'S', 'T',
	'U', 'V', 'W', 'X',
	'Y', 'Z', ' ', '.',
	',', '-', '\'', '?'
};

string code(char c){
	return coder[index(c)];
}

char uncode(string s){
	int num = 0;
	for(int i = 0, j = 16;i < 5; i++, j = j / 2){
		if(s[i] == '1') num += j;
	}
	return uncoder[num];
}

int main(){
	string s;
	while(getline(cin, s)){
		string t;
		for(string::iterator iter = s.begin();
			iter != s.end(); iter++)
		{
			t += code(*iter);
		}
		while(t.size() % 5 != 0) t += "0";
		for(string::iterator iter = t.begin();
			iter != t.end(); iter += 5)
		{
			string t2(iter, iter + 5);
			cout << uncode(t2);
		}
		cout << endl;
	}
	return 0;
}