/*
	0088:The Code A Doctor Loved
*/
#include	<iostream>
#include	<string>

using namespace std;

const string convertList[2][32] = 
	{
		{
			  "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"
		},
		{
			"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111",
			"01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111",
			"10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111",
			"11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111"
		}
	};

const char charList[32] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";

int main(void) {
	string str, buff, result;
	
	getline(cin, str);
	
	string::iterator str_it = str.begin();
	while(str_it != str.end()) {
		for(int i = 0; i < 32; i++) {
			if(*str_it == charList[i]) {
				buff += convertList[0][i];
				break;
			}
		}
		str_it++;
	}
	while( buff.size() % 5 != 0 ) {
		buff += '0';
	}
	string::iterator buff_it = buff.begin();
	while( buff_it != buff.end() ) {
		string buffbuff;
		
		for(int i = 0; i < 5; i++, buff_it++) {
			buffbuff += *buff_it;
		}
		for(int i = 0; i < 32; i++) {
			if(buffbuff == convertList[1][i]) {
				result += charList[i];
				break;
			}
		}
	}
	cout << result << endl;
}