#include <iostream>
#include <string>
#include <map>
using namespace std;
int stoi(string s){
	int c = 0,a = 16;
	for(int i = 0;i < s.length();++i){
		c += a * (int)(s[i] - '0');
		a /= 2;
	}
	return c;
}
int main(){
	map<char,string> dic;
	dic[' '] = "101";
	dic['\''] = "000000";
	dic[','] = "000011";
	dic['-'] = "10010001";
	dic['.'] = "010001";
	dic['?'] = "000001";
	dic['A'] = "100101";
	dic['B'] = "10011010";
	dic['C'] = "0101";
	dic['D'] = "0001";
	dic['E'] = "110";
	dic['F'] = "01001";
	dic['G'] = "10011011";
	dic['H'] = "010000";
	dic['I'] = "0111";
	dic['J'] = "10011000";
	dic['K'] = "0110";
	dic['L'] = "00100";
	dic['M'] = "10011001";
	dic['N'] = "10011110";
	dic['O'] = "00101";
	dic['P'] = "111";
	dic['Q'] = "10011111";
	dic['R'] = "1000";
	dic['S'] = "00110";
	dic['T'] = "00111";
	dic['U'] = "10011100";
	dic['V'] = "10011101";
	dic['W'] = "000010";
	dic['X'] = "10010010";
	dic['Y'] = "10010011";
	dic['Z'] = "10010000";
	char dic2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
	string str;
	int a;
	while(getline(cin,str)){
		string s,s1;
		s = s1 = "";
		for(int i = 0;i < str.length();++i){
			s += dic[str[i]];
		}
		if(s.length() % 5 != 0) {
			a = 5 - (s.length() % 5);
			for(int i = 0;i < a;++i){
				s += '0';
			}
		}
		for(int i = 0;i < s.length();i += 5){
			s1 += dic2[stoi(s.substr(i,5))];
		}
		cout << s1 << endl;
	}
	return 0;
}