#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string L="ABCDEFGHIJKLMNOPQRSTUVWXYZ",A=" ',-.?"+L,C=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"};
int bin2dec(string s){
	int x=0,i=0;
	for(;i<s.size();i++)x=x*2+s[i]-'0';
	return x;
}
int main(){
	string s,s1;
	int i,n;
	while(getline(cin,s)){
		s1="";
		for(i=0;i<s.size();i++)s1+=B[A.find(s[i])];
		n=s1.size()%5;
		if(n!=0)s1+=string(5-n,'0');
		s="";
		for(i=0;i<s1.size();i+=5)s+=C[bin2dec(s1.substr(i, 5))];
		cout<<s<< endl;
	}
}