#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1000000001
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
string angou[26]={"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 to_i(string s){
      int res=0,k=1;
      for(int i=4;i>=0;i--){
            if(s[i]=='1')res+=k;
            k*=2;
      }
      return res;
}
string to(char c){
      if(c==' ')return "101";
      if(c=='\'')return "000000";
      if(c=='-')return "10010001";
      if(c=='.')return "010001";
      if(c=='?')return "000001";
      return angou[c-'A'];
}
char from(string a){
      int aa=to_i(a);
      if(0<=aa&&aa<=25)return 'A'+aa;
      if(aa==26)return ' ';
      if(aa==27)return '.';
      if(aa==28)return ',';
      if(aa==29)return '-';
      if(aa==30)return '\'';
      return '?';
}
int main(){
      string s;
      getline(cin,s);
      string t="";
      REP(i,s.size())t+=to(s[i]);
      while(t.size()%5!=0)t+='0';
      s="";
      cout<<t<<endl;
      for(int i=0;i<t.size();i+=5){
            string a;a.assign(t,i,5);
            s+=from(a);
      }
      cout<<s<<endl;
}