#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

string s, t, ans;
string table = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string p[] = { "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 table2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";

int main(){
	while (getline(cin, s)){
		REP(i, s.size()){
			REP(j, table.size()){
				if (s[i] == table[j]){
					t += p[j];
				}
			}
		}		
		if (t.size() % 5 != 0){
			int a = 5 - t.size() % 5;
			REP(i, a){
				t += "0";
			}
		}
		for (int i = 0; i < t.size(); i += 5){
			string k = t.substr(i, 5);
			int sum = 0;
			REP(i, 5){
				if (i != 4) sum += pow(2 * (k[i] - '0'), 4 - i);
				else sum += k[i] - '0';
			}
			ans += table2[sum];
		}
		cout << ans << endl;
		t.clear();
		ans.clear();
	}
}