//
// Written by Fyodor Menshikov 10.03.2009
// 11:03-11:38
//

import java.io.*;
import java.util.*;

class Main {

   InputStream in;
   OutputStream out;

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   int read() {
      try {
         return in.read();
      } catch (IOException e) {
         throw new Error(e);
      }
   }

   void skip(String s) {
      for (int i = 0; i < s.length(); i++) {
         asserT(read() == s.charAt(i));
      }
   }

   void write(byte b) {
      try {
         out.write(b);
      } catch (IOException e) {
         throw new Error(e);
      }
   }

   void write(int i) {
      write((byte)i);
   }

   void write(String s) {
      for (int i = 0; i < s.length(); i++) {
         write(s.charAt(i));
      }
   }

   void solve() {
      final String ENC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
      skip("Content-Transfer-Encoding: ");
      int enc = read();
      if (enc == '8') {
         skip("bit\r\n\r\n");
         write("Content-Transfer-Encoding: base64\r\n\r\n");
         int lineLen = 0;
         while (true) {
            int b1 = read();
            int b2 = read();
            int b3 = read();
            int nEq;
            if (b1 == -1) {
               break;
            } else if (b2 == -1) {
               asserT(b3 == -1);
               b2 = 0;
               b3 = 0;
               nEq = 2;
            } else if (b3 == -1) {
               b3 = 0;
               nEq = 1;
            } else {
               nEq = 0;
            }
            asserT(0 <= b1 && b1 <= 255);
            asserT(0 <= b2 && b2 <= 255);
            asserT(0 <= b3 && b3 <= 255);
            int v = b1 << 16 | b2 << 8 | b3;
            char c1 = ENC.charAt((v >> 18) & 63);
            char c2 = ENC.charAt((v >> 12) & 63);
            char c3 = ENC.charAt((v >> 6) & 63);
            char c4 = ENC.charAt((v >> 0) & 63);
            if (nEq == 1) {
               c4 = '=';
            } else if (nEq == 2) {
               c3 = '=';
               c4 = '=';
            } else {
               asserT(nEq == 0);
            }
            write(c1);
            write(c2);
            write(c3);
            write(c4);
            lineLen += 4;
            if (lineLen == 76) {
               write(13);
               write(10);
               lineLen = 0;
            }
         }
         if (lineLen > 0) {
            write(13);
            write(10);
         }
      } else {
         asserT(enc == 'b');
         skip("ase64\r\n\r\n");
         write("Content-Transfer-Encoding: 8bit\r\n\r\n");
         StringBuilder s = new StringBuilder(4);
         while (true) {
            int c = read();
            if (c == -1) {
               break;
            }
            if (c == 13 || c == 10) {
               continue;
            }
            s.append((char)c);
            if (s.length() == 4) {
               int c1 = ENC.indexOf(s.charAt(0)) & 63;
               int c2 = ENC.indexOf(s.charAt(1)) & 63;
               int c3 = ENC.indexOf(s.charAt(2)) & 63;
               int c4 = ENC.indexOf(s.charAt(3)) & 63;
               int value = c1 << 18 | c2 << 12 | c3 << 6 | c4;
               int b1 = (value >> 16) & 0xFF;
               int b2 = (value >> 8) & 0xFF;
               int b3 = (value >> 0) & 0xFF;
               write(b1);
               if (s.charAt(2) != '=') {
                  write(b2);
               }
               if (s.charAt(3) != '=') {
                  write(b3);
               }
               s.setLength(0);
            }
         }
         asserT(s.length() == 0);
      }
   }
   
   void run() {
      try {
         in = new BufferedInputStream(System.in);
         out = new BufferedOutputStream(System.out);
         try {
            solve();
         } finally {
            out.close();
         }
      } catch (IOException e) {
         throw new Error(e);
      }
   }

   public static void main(String args[]) {
      new Main().run();
   }
}