#!/usr/bin/perl

use MIME::Base64 qw(encode_base64);

my $buf = "";
while (<>) {
    $buf .= $_;
    if (length($buf) >= 57) {
	print encode_base64(substr($buf, 0, int(length($buf) / 57) * 57, ""));
    }
}

print encode_base64($buf);
