#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string L = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string A = " ',-.?" + L;
string B = "101 000000 000011 10010001 010001 000001 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";
string C = L + " .,-'?";
int bin2dec(string s){
	int x=0,i;
	for (i=0;i<s.size();i++){
		x *= 2;
		if (s[i] =='1')x++;
	}
	return x;
}
int main(){
	vector<string>x(32);
	stringstream ss(B);
	string s,s1,s0;
	int i,n,p;
	for (i = 0; i < 32; i++){
		ss >> s;
		x[i]=s;
	}
	while(getline(cin,s)){
		n = s.size();
		s1 = "";
		for (i = 0; i < n; i++){
			s1+=x[A.find(s[i])];
		}
		n = s1.size()%5;
		if (n!= 0)s1 += string(5 - n,'0');
		n = s1.size();
		s = "";
		for (i = 0; i < n; i += 5){
			p= bin2dec(s1.substr(i, 5));
			s += C[p];
		}
		cout << s << endl;
	}
}