import std.stdio,std.string,std.conv;

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

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

	string s;
	string str = "";
	while((s = readln.chomp).length != 0)
	{
		foreach(i;0..s.length)
		{
			str ~= ID[s[i]];
		}

		while(str.length % 5 != 0)
		{
			str ~= "0";
		}

		string ans = "";
		while(str.length != 0)
		{
			string temp = str[0..5];
			ans ~= Id[temp];
			str = str[5..$];
		}
		ans.writeln;
	}
	return 0;
}