#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
vector<int> v;
string s,n="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",m=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ",l[32]={"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 main(){
	while(getline(cin,s)){
		v.clear();
		for(int i=0;i<s.size();i++){
			int p=0;while(m[p]!=s[i])p++;
			for(int j=0;j<l[p].size();j++)v.push_back(l[p][j]-'0');
		}
		for(int i=0;i<v.size();i+=5){
			int cnt=0;
			for(int j=0;j<5;j++)cnt*=2,cnt+=v[i+j];
			cout<<n[cnt];
		}cout<<endl;
	}
	return 0;
}