#include <stdio.h>

int bpp = 32;

struct bmphead
{
	unsigned char type1;
	unsigned char type2;
	unsigned long int filesize;
	unsigned long int reserved;
	unsigned long int offset;
}bmphead;

struct dibhead
{
	unsigned int headsize;		//should be 40
	int bmpwidth;
	int bmpheight;
	unsigned short numcolorsplanes; 	//should be 1
	unsigned short bitsperpixel;		//1 4 8 16 24 32
	unsigned int compression;		//we  will only support 0
	unsigned int imagesize;		//can be 0 if no compression 
	int horizontalppm;	//pixelpermeter can be 0
	int verticalppm;		//can be 0
	unsigned int palettecolorsnumber;	//if zero default = 2^bitsperpixels
	unsigned int importantcolorsused;	//can be 0
}dibhead;

int main(void)
{
	int spc = 0;
	int nl = 0;
	char c;
	while(c != EOF)
	{
		c = getchar();
		if (c == ' ')
		{
			spc += 1;
		}
		if (c == '\n')
		{
			nl += 1;
		}
	}
		bmphead.type1 = 'B';
		bmphead.type2 = 'M';
		bmphead.filesize = 54 + ((bpp/8)*spc);
		bmphead.reserved = 0;
		bmphead.offset = 0;
		
		dibhead.headsize = 40;
		dibhead.bmpwidth = spc /nl;
		dibhead.bmpheight = nl;
		dibhead.numcolorsplanes = 1;
		dibhead.bitsperpixel = bpp;
		dibhead.compression = 0;
		dibhead.imagesize = 0;
		dibhead.horizontalppm=0;
		dibhead.verticalppm=0;
		dibhead.palettecolorsnumber=0;
		dibhead.importantcolorsused=0;
	int i;
	for (i=0 ; i<14 ; i++)
	{
		putchar( *(((char*)&bmphead) + i) );
	}
	for (i=0 ; i<40 ; i++)
	{
		putchar( *(((char*)&dibhead) + i) );
	}

	return 0;
}
