#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

string s,t,c[]={"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)){
		t="";
		int cur=0;
		while(cur<s.size()){
			if(s[cur]==' ')t+="101";
			if(s[cur]=='\'')t+="000000";
			if(s[cur]==',')t+="000011";
			if(s[cur]=='-')t+="10010001";
			if(s[cur]=='.')t+="010001";
			if(s[cur]>='A'&&s[cur]<='Z')t+=c[s[cur]-'A'];
			cur++;
		}
		if(t.size()%5)rep(i,5-t.size()%5)t+="0";
		rep(i,t.size())t[i]-='0';
		cur=0;
		s="";
		while(cur<t.size()){
			int a=t[cur]*16+t[cur+1]*8+t[cur+2]*4+t[cur+3]*2+t[cur+4];
			if(a<=25)s+='A'+a;
			if(a==26)s+=' ';
			if(a==27)s+='.';
			if(a==28)s+=',';
			if(a==29)s+='-';
			if(a==30)s+='\'';
			if(a==31)s+='?';
			cur+=5;
		}
		cout<<s<<endl;
	}
}