#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;

string str[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"};
string bf=" ',-.?";
string af=" .,-'?";

int change_to_10(string s,int from){
	int ans=0;
	rep(i,0,s.size()){
		ans+=(s[i]-'0')*pow(from,s.size()-1-i);
	}
	return ans;
}

signed main(){
	string s;
	while(getline(cin, s)){
		string tmp = "", ans = "";
		rep(i, 0, s.size()){
			if('A' <= s[i] && s[i] <= 'Z'){
				tmp += str[6 + (int)(s[i] - 'A')];
			}else{
				int p = bf.find(s[i]);
				tmp += str[p];
			}
		}
		//cout << tmp <<endl;
		while(tmp.size() % 5 != 0){
			tmp += '0';
		}
		//cout << tmp <<endl;
		rep(i, 0, tmp.size()/ 5){
			int p = change_to_10(tmp.substr(5 * i, 5), 2);
			if(p < 26){
				ans += (char)('A' + p);
			}else{
				ans += af[p - 26];
			}
		}
		cout << ans << endl;
	}
}