#include <iostream>
#include <string>

using namespace std;

const char *TABLE[] = {
	"100101",
	"10011010",
	"0101",
	"0001",
	"110",
	"01001",
	"10011011",
	"010000",
	"0111",
	"10011000",
	"0110",
	"00100",
	"10011001",
	"10011110",
	"00101",
	"111",
	"10011111",
	"1000",
	"00110",
	"00111",
	"10011100",
	"10011101",
	"000010",
	"10010010",
	"10010011",
	"10010000",
	"101",
	"000000",
	"000011",
	"10010001",
	"010001",
	"010001"
};

const char *load_table(char c){
	switch(c){
		case ' ': return TABLE[26];
		case '\'': return TABLE[27];
		case ',': return TABLE[28];
		case '-': return TABLE[29];
		case '.': return TABLE[30];
		case '?': return TABLE[31];
		default: return TABLE[c - 'A'];
	}
}

char bin2c(const string &s){
	int c = 0;
	for(int i = 0; i < s.size(); ++i){ c = (c << 1) | (s[i] - '0'); }
	switch(c){
		case 26: return ' ';
		case 27: return '.';
		case 28: return ',';
		case 29: return '-';
		case 30: return '\'';
		case 31: return '?';
		default: return static_cast<char>(c + 'A');
	}
}

int main(){
	string s;
	while(getline(cin, s)){
		string bin;
		for(int i = 0; i < s.size(); ++i){
			bin += load_table(s[i]);
		}
		while(bin.size() % 5 != 0){ bin += "0"; }
		for(int i = 0; i < bin.size(); i += 5){
			cout << bin2c(bin.substr(i, 5));
		}
		cout << endl;
	}
	return 0;
}