#include<iostream>
#include<map>
#include<sstream>

std::string to_bs(int i){
	std::string s = "";
	while(i > 0){
		s = static_cast<char>(i%2+'0') + s;
		i /= 2;
	}
	while(s.length() < 5){
		s = '0' + s;
	}
	return s;
}

int main(){
	std::map<char, std::string> input;
	std::map<std::string, char> output;
	input[' '] = "101";
	input['\''] = "000000";
	input[','] = "000011";
	input['-'] = "10010001";
	input['.'] = "010001";
	input['?'] = "000001";
	input['A'] = "100101";
	input['B'] = "10011010";
	input['C'] = "0101";
	input['D'] = "0001";
	input['E'] = "110";
	input['F'] = "01001";
	input['G'] = "10011011";
	input['H'] = "010000";
	input['I'] = "0111";
	input['J'] = "10011000";
	input['K'] = "0110";
	input['L'] = "00100";
	input['M'] = "10011001";
	input['N'] = "10011110";
	input['O'] = "00101";
	input['P'] = "111";
	input['Q'] = "10011111";
	input['R'] = "1000";
	input['S'] = "00110";
	input['T'] = "00111";
	input['U'] = "10011100";
	input['V'] = "10011101";
	input['W'] = "000010";
	input['X'] = "10010010";
	input['Y'] = "10010011";
	input['Z'] = "10010000";
	
	for(int i=0;i<26;i++){
		output[to_bs(i)] = 'A' + i;
	}
	output["11010"] = ' ';
	output["11011"] = '.';
	output["11100"] = ',';
	output["11101"] = '-';
	output["11110"] = '\'';
	output["11111"] = '?';

	std::string s;
	while(std::getline(std::cin, s), !std::cin.eof()){
		std::string bs = "";
		for(int i=0;i<s.length();i++){
			bs += input[s[i]];
		}

		while(bs.length()%5){
			bs += '0';
		}

		std::string res = "";
		while(bs.length()){
			std::string _s = bs.substr(0, 5);
			res += output[_s];
			bs = bs.substr(5);
		}

		std::cout << res << std::endl;

		std::cin.clear();
	}
}