#include <stdio.h>

#define ENC(c) (((c)&077)+' ')

void uuenc(FILE *in,FILE *out)
{
	char buff[80];
	int i,x,c;

	do {
		for (x=0;x<45;x++) {
			c=fgetc(in);
			if(c==EOF) break;
			buff[x]=c;
		}
		putc(ENC(x),out);
		if(x>=0) {	
			for (i=0;i<x;i+=3) {		
				putc(ENC(buff[i]>>2),out);
				putc(ENC((buff[i]<<4)&060)|((buff[i+1]>>4)&017),out);
				putc(ENC((buff[i+1]<<2)&074)|((buff[i+2]>>6)&03),out);
				putc(ENC(buff[i+2]&077),out);
			}
			putc('\n',out);
		}
	} while(x>0);
}

