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

string encode[] = 
{" 101",
"'000000",
",000011",
"-10010001",
".010001",
"?000001",
"A100101",
"B10011010",
"C0101",
"D0001",
"E110",
"F01001",
"G10011011",
"H010000",
"I0111",
"J10011000",
"K0110",
"L00100",
"M10011001",
"N10011110",
"O00101",
"P111",
"Q10011111",
"R1000",
"S00110",
"T00111",
"U10011100",
"V10011101",
"W000010",
"X10010010",
"Y10010011",
"Z10010000"
};

string decode[] =
{"00000A",
"00001B",
"00010C",
"00011D",
"00100E",
"00101F",
"00110G",
"00111H",
"01000I",
"01001J",
"01010K",
"01011L",
"01100M",
"01101N",
"01110O",
"01111P",
"10000Q",
"10001R",
"10010S",
"10011T",
"10100U",
"10101V",
"10110W",
"10111X",
"11000Y",
"11001Z",
"11010 ",
"11011.",
"11100,",
"11101-",
"11110'",
"11111?"
};

int main(){
	map<char,string> enc_m;
	map<string,char> dec_m;
	for(int i = 0 ; i < 32 ; i++){
		enc_m[encode[i][0]] = encode[i].substr(1);
		dec_m[decode[i].substr(0,5)] = decode[i][5];
	}
	string ln;
	while(getline(cin,ln)){
		string to,ans;
		for(int i = 0 ; i < ln.size() ; i++)
			to  += enc_m[ln[i]];
		while(to.size()%5)to += "0";
		for(int i = 0 ; i < to.size() ; i+=5)
			ans += dec_m[to.substr(i,5)];
		cout << ans << endl;
	}
}