#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

int main ()
{
	map<char , string>data;
	data[' '] = "101";
	data['\''] = "000000";
	data[','] = "000011";
	data['-'] = "10010001";
	data['.'] = "010001";
	data['?'] = "000001";
	data['A'] = "100101";
	data['B'] = "10011010";
	data['C'] = "0101";
	data['D'] = "0001";
	data['E'] = "110";
	data['F'] = "01001";
	data['G'] = "10011011";
	data['H'] = "010000";
	data['I'] = "0111";
	data['J'] = "10011000";
	data['K'] = "0110";
	data['L'] = "00100";
	data['M'] = "10011001";
	data['N'] = "10011110";
	data['O'] = "00101";
	data['P'] = "111";
	data['Q'] = "10011111";
	data['R'] = "1000";
	data['S'] = "00110";
	data['T'] = "00111";
	data['U'] = "10011100";
	data['V'] = "10011101";
	data['W'] = "000010";
	data['X'] = "10010010";
	data['Y'] = "10010011";
	data['Z'] = "10010000";
	string test , in;
	string match;
	string ans;
	while(  getline(cin,in) )
	{
		test += in + " ";
	}
	test.erase ( test.end ()-1 );
	for( auto x : test )
	{
		match += data[x];
	}
	//cout << match.length () << endl;
	int p;
	for( size_t i = 0 , p = match.length (); i < 4 - ( ( p - 1 ) % 5 ); i++ )
	{
		match += "0";
	}
	//cout << match << endl;
	for( size_t i = 0; i < match.length()/5; i++ )
	{
		int num = 0;
		for( size_t j = 0; j < 5; j++ )
		{
			num *= 2;
			if( match[i * 5 + j]=='1' )
			{
				num += 1;
			}
		}
		//cout << num<<endl;
		if( num + 'A' <= 'Z' )
		{
			ans += (num + 'A');
		} else
		{
			num -= 25;
			switch( num )
			{
				case 0:ans += ' '; break;
				case 1:ans += '.'; break;
				case 3:ans += ','; break;
				case 4:ans += '-'; break;
				case 5:ans += '\''; break;
				case 6:ans += '?'; break;
			}
		}
	}
	cout << ans << endl;
}