#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string T[255];
	T[' '] = "101";
	T['\''] = "000000";
	T[','] = "000011";
	T['-'] = "10010001";
	T['.'] = "010001";
	T['?'] = "000001";
	T['A'] = "100101";
	T['B'] = "10011010";
	T['C'] = "0101";
	T['D'] = "0001";
	T['E'] = "110";
	T['F'] = "01001";
	T['G'] = "10011011";
	T['H'] = "010000";
	T['I'] = "0111";
	T['J'] = "10011000";
	T['K'] = "0110";
	T['L'] = "00100";
	T['M'] = "10011001";
	T['N'] = "10011110";
	T['O'] = "00101";
	T['P'] = "111";
	T['Q'] = "10011111";
	T['R'] = "1000";
	T['S'] = "00110";
	T['T'] = "00111";
	T['U'] = "10011100";
	T['V'] = "10011101";
	T['W'] = "000010";
	T['X'] = "10010010";
	T['Y'] = "10010011";
	T['Z'] = "10010000";

	string in;
	while (getline(cin, in)){
		string trans = "";
		for (int i = 0; i < in.size(); i++){
			trans += T[in[i]];
		}
		int add = (trans.size() + 4) / 5 * 5 - trans.size();
		for (int i = 0; i < add; i++) trans += '0';
		
		int val = 0;
		for (int i = 0; i < trans.size(); i++){
			val <<= 1;
			val += trans[i] == '1';
			if ((i + 1) % 5 == 0){
				printf("%c", "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[val]);
				val = 0;
			}
		}
		puts("");
	}
	return (0);
}