#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;const string table[] ={"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",};void out( const string &s ){int n = strtol( s.substr( 0, 5 ).c_str(), 0, 2 );if( n < 26 )putchar( n + 'A' );else putchar( " .,-'?"[n - 26] );}int main(){int c;string s;for(; c = getchar(), c != EOF; ){switch(c){case '\n':if( s.length() > 0 ){s += "0000";out(s);}puts("");s = "";break;case ' ':s += "101";break;case '\'':s += "000000";break;case ',':s += "000011";break;case '-':s += "10010001";break;case '.':s += "010001";break;case '?':s += "000001";break;default:s += table[c - 'A'];break;}while( s.length() > 4 ){out( s );s = s.substr(5);}}}