#include <iostream>
#include <sstream>
#include <string>
#include <map>
using namespace std;
int main(){
	map<char,string> mp;
	map<string,char> mp2;
	mp[' '] = "101";
	mp['\''] = "000000";
	mp[','] = "000011";
	mp['-'] = "10010001";
	mp['.'] = "010001";
	mp['?'] = "000001";
	mp['A'] = "100101";
	mp['B'] = "10011010";
	mp['C'] = "0101";
	mp['D'] = "0001";
	mp['E'] = "110";
	mp['F'] = "01001";
	mp['G'] = "10011011";
	mp['H'] = "010000";
	mp['I'] = "0111";
	mp['J'] = "10011000";
	mp['K'] = "0110";
	mp['L'] = "00100";
	mp['M'] = "10011001";
	mp['N'] = "10011110";
	mp['O'] = "00101";
	mp['P'] = "111";
	mp['Q'] = "10011111";
	mp['R'] = "1000";
	mp['S'] = "00110";
	mp['T'] = "00111";
	mp['U'] = "10011100";
	mp['V'] = "10011101";
	mp['W'] = "000010";
	mp['X'] = "10010010";
	mp['Y'] = "10010011";
	mp['Z'] = "10010000";
	mp2["00000"] = 'A';
	mp2["00001"] = 'B';
	mp2["00010"] = 'C';
	mp2["00011"] = 'D';
	mp2["00100"] = 'E';
	mp2["00101"] = 'F';
	mp2["00110"] = 'G';
	mp2["00111"] = 'H';
	mp2["01000"] = 'I';
	mp2["01001"] = 'J';
	mp2["01010"] = 'K';
	mp2["01011"] = 'L';
	mp2["01100"] = 'M';
	mp2["01101"] = 'N';
	mp2["01110"] = 'O';
	mp2["01111"] = 'P';
	mp2["10000"] = 'Q';
	mp2["10001"] = 'R';
	mp2["10010"] = 'S';
	mp2["10011"] = 'T';
	mp2["10100"] = 'U';
	mp2["10101"] = 'V';
	mp2["10110"] = 'W';
	mp2["10111"] = 'X';
	mp2["11000"] = 'Y';
	mp2["11001"] = 'Z';
	mp2["11010"] = ' ';
	mp2["11011"] = '.';
	mp2["11100"] = ',';
	mp2["11101"] = '-';
	mp2["11110"] = '\'';
	mp2["11111"] = '?';
	string s,t;
	bool start = true;
	while(getline(cin,s)){
		if(not start) t += mp[' '];
		for(int i=0;i<s.size();i++){
			char a = s[i];
			if(start and i==0) t = mp[a];
			else t += mp[a];
		}
		start = false;
	}
	s = t;
	for(int i=0;i<(5-t.size()%5)%5;i++) s += "0";
	cout << s << " " << s.size() << endl;
	for(int i=0;i<s.size()/5;i++) cout << mp2[s.substr(5*i,5)];
	cout << endl;
}