#include<iostream>
#include<string>
using namespace std;

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

char ftoc(string x) {
	if (x == "00000")return'A';
	if (x == "00001")return'B';
	if (x == "00010")return'C';
	if (x == "00011")return'D';
	if (x == "00100")return'E';
	if (x == "00101")return'F';
	if (x == "00110")return'G';
	if (x == "00111")return'H';
	if (x == "01000")return'I';
	if (x == "01001")return'J';
	if (x == "01010")return'K';
	if (x == "01011")return'L';
	if (x == "01100")return'M';
	if (x == "01101")return'N';
	if (x == "01110")return'O';
	if (x == "01111")return'P';
	if (x == "10000")return'Q';
	if (x == "10001")return'R';
	if (x == "10010")return'S';
	if (x == "10011")return'T';
	if (x == "10100")return'U';
	if (x == "10101")return'V';
	if (x == "10110")return'W';
	if (x == "10111")return'X';
	if (x == "11000")return'Y';
	if (x == "11001")return'Z';
	if (x == "11010")return' ';
	if (x == "11011")return'.';
	if (x == "11100")return',';
	if (x == "11101")return'-';
	if (x == "11110")return'\'';
	else return'?';
}

int main() {
	string s;

	while (getline(cin, s)) {
		string sa;
		sa = ctof(s[0]);
		for (int i = 1;i < s.size();i++) {
			sa += ctof(s[i]);
		}
		int z = sa.size();
		if (z % 5 != 0) {
			for (int i = z % 5;i <= 5;i++)sa.push_back('0');
		}
		string sb;
		for (int i = 0;i < z;i += 5) {
			string c = sa.substr(i, 5);
			sb.push_back(ftoc(c));
		}
		cout << sb << endl;
	}
	getchar();
	return 0;
}