#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<string>
#include<map>
using namespace std;

map<string, string> wtoi;
map<string, string> itow;

void make_dictonary1() {
	wtoi[" "] = "101"; wtoi["'"] = "000000"; wtoi[","] = "000011"; wtoi["-"] = "10010001"; wtoi["."] = "010001";
	wtoi["?"] = "000001"; wtoi["A"] = "100101"; wtoi["B"] = "10011010"; wtoi["C"] = "0101"; wtoi["D"] = "0001";
	wtoi["E"] = "110"; wtoi["F"] = "01001"; wtoi["G"] = "10011011"; wtoi["H"] = "010000"; wtoi["I"] = "0111";
	wtoi["J"] = "10011000 "; wtoi["K"] = "0110"; wtoi["L"] = "00100"; wtoi["M"] = "10011001"; wtoi["N"] = "00101";
	wtoi["O"] = "00101"; wtoi["P"] = "111"; wtoi["Q"] = "10011111"; wtoi["R"] = "1000"; wtoi["S"] = "00110";
	wtoi["T"] = "00111"; wtoi["U"] = "10011100"; wtoi["V"] = "10011101"; wtoi["W"] = "000010"; wtoi["X"] = "10010010"; 
	wtoi["Y"] = "10010011"; wtoi["Z"] = "10010000";
}
void make_dictonary2() {
	int i, j;
	for( i = 0; i < 26; i++ ) {
		char c = 'A' + i;
		string str;
		str += c;
		string in;
		for( j = 4; j >= 0; j-- ) {
			if ( (i>>(j))%2 )
				in += '1';
			else
				in += '0';
		}
		itow[in] = str;
	}
	itow["11011"] = "."; itow["11100"] = ","; itow["11101"] = "-"; itow["11110"] = "'"; itow["11111"] = "?";
}

char buf[512];
int buflen;

int main() {
	make_dictonary1();
	make_dictonary2();
	int i, j;
	while(gets(buf)) {
		buflen = strlen(buf);
		
		string intejor;
		
		for( i = 0; i < buflen; i++ ) {
			string in;
			in += buf[i];
			intejor += wtoi[in];
		}
		
		string str[514];
		for( i = 0; i < intejor.length(); i+=5 ) {
			for( int j = i; j < i + 5; j++ ) {
				if ( j >= intejor.length() )
					str[i] += '0';
				else
					str[i] += intejor[j];
			}
			//cout << str[i] << endl;
		}
		
		for( j = 0; j < i; j++ ) {
			cout << itow[str[j]];
		}
		cout << endl;
	}
	return 0;
}