#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

map<char, int>notal{
	{ ' ',26 },{ '.',27 },{ ',',28 },{ '-',29 },{ '\'',30 },{ '?',31 }
};
map<int, char>mp{
	{ 26,' ' },{ 27,'.' },{ 28,',' },{ 29,'-' },{ 30,'\'' },{ 31,'?' },
};
string code[]{ "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","000001" };
int bin(string s) {
	reverse(s.begin(), s.end());
	int i = 1;
	int res = 0;
	for (char c : s) {
		res += i*(c - '0');
		i <<= 1;
	}
	return res;
}
int main() {
	string s;
	string buf;
	while (getline(cin, buf) && buf != "") {
		if (s != "")s += ' ';
		s += buf;
	}
	string ss;
	for (char c : s) {
		if (isalpha(c))ss += code[c - 'A'];
		else ss += code[notal[c]];
	}
	while (ss.size() % 5)ss += '0';
	string ans;
	for (int i = 0; i <= ss.size() - 5; i += 5) {
		int d = bin(ss.substr(i, 5));
		if (d < 26)ans += 'A' + d;
		else ans += mp[d];
	}
	cout << ans << endl;
}