#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
using namespace std;
int main() {
	map<char, string>a;
	string h = "'";
	a.insert(map<char, string>::value_type(' ',"101"));
	a.insert(map<char, string>::value_type(h[0], "000000"));
	a.insert(map<char, string>::value_type(',', "000011"));
	a.insert(map<char, string>::value_type('-', "10010001"));
	a.insert(map<char, string>::value_type('.', "010001"));
	a.insert(map<char, string>::value_type('?', "000001"));
	a.insert(map<char, string>::value_type('A', "100101"));
	a.insert(map<char, string>::value_type('B', "10011010"));
	a.insert(map<char, string>::value_type('C', "0101"));
	a.insert(map<char, string>::value_type('D', "0001"));
	a.insert(map<char, string>::value_type('E', "110"));
	a.insert(map<char, string>::value_type('F', "01001"));
	a.insert(map<char, string>::value_type('G', "10011011"));
	a.insert(map<char, string>::value_type('H', "010000"));
	a.insert(map<char, string>::value_type('I', "0111"));
	a.insert(map<char, string>::value_type('J', "10011000"));
	a.insert(map<char, string>::value_type('K', "0110"));
	a.insert(map<char, string>::value_type('L', "00100"));
	a.insert(map<char, string>::value_type('M', "10011001"));
	a.insert(map<char, string>::value_type('N', "10011110"));
	a.insert(map<char, string>::value_type('O', "00101"));
	a.insert(map<char, string>::value_type('P', "111"));
	a.insert(map<char, string>::value_type('Q', "10011111"));
	a.insert(map<char, string>::value_type('R', "1000"));
	a.insert(map<char, string>::value_type('S', "00110"));
	a.insert(map<char, string>::value_type('T', "00111"));
	a.insert(map<char, string>::value_type('U', "10011100"));
	a.insert(map<char, string>::value_type('V', "10011101"));
	a.insert(map<char, string>::value_type('W', "000010"));
	a.insert(map<char, string>::value_type('X', "10010010"));
	a.insert(map<char, string>::value_type('Y', "10010011"));
	a.insert(map<char, string>::value_type('Z', "10010000"));
	map<string, char>b;
	b.insert(map<string, char>::value_type("00000", 'A'));
	b.insert(map<string, char>::value_type("00001", 'B'));
	b.insert(map<string, char>::value_type("00010", 'C'));
	b.insert(map<string, char>::value_type("00011", 'D'));
	b.insert(map<string, char>::value_type("00100", 'E'));
	b.insert(map<string, char>::value_type("00101", 'F'));
	b.insert(map<string, char>::value_type("00110", 'G'));
	b.insert(map<string, char>::value_type("00111", 'H'));
	b.insert(map<string, char>::value_type("01000", 'I'));
	b.insert(map<string, char>::value_type("01001", 'J'));
	b.insert(map<string, char>::value_type("01010", 'K'));
	b.insert(map<string, char>::value_type("01011", 'L'));
	b.insert(map<string, char>::value_type("01100", 'M'));
	b.insert(map<string, char>::value_type("01101", 'N'));
	b.insert(map<string, char>::value_type("01110", 'O'));
	b.insert(map<string, char>::value_type("01111", 'P'));
	b.insert(map<string, char>::value_type("10000", 'Q'));
	b.insert(map<string, char>::value_type("10001", 'R'));
	b.insert(map<string, char>::value_type("10010", 'S'));
	b.insert(map<string, char>::value_type("10011", 'T'));
	b.insert(map<string, char>::value_type("10100", 'U'));
	b.insert(map<string, char>::value_type("10101", 'V'));
	b.insert(map<string, char>::value_type("10110", 'W'));
	b.insert(map<string, char>::value_type("10111", 'X'));
	b.insert(map<string, char>::value_type("11000", 'Y'));
	b.insert(map<string, char>::value_type("11001", 'Z'));
	b.insert(map<string, char>::value_type("11010", ' '));
	b.insert(map<string, char>::value_type("11011", '.'));
	b.insert(map<string, char>::value_type("11100", ','));
	b.insert(map<string, char>::value_type("11101", '-'));
	b.insert(map<string, char>::value_type("11110", h[0]));
	b.insert(map<string, char>::value_type("11111", '?'));
	string s;
	while (getline(cin,s)) {
		h = "";
		for (int i = 0; i < s.length(); i++) {
			h += a[s[i]];
		}
		while (h.length() % 5 != 0) {
			h += "0";
		}
		string d = "";
		for (int i = 0; i < h.length(); i += 5) {
			string e = h.substr(i, 5);
			d += b[e];
		}
		cout << d << endl;
	}
}