#include <stdio.h>
#include <math.h>
#include <stdlib.h>

void main(int argc, char *argv[])

{
 int a, b, c, d;

 a = atoi (argv[1]);

 d = a % 10; a /= 10;
 c = a % 10; a /= 10;
 b = a % 10; a /= 10;
 a = a % 10;

if (a == 0);
 else
   {
    num (a);
    printf(" thousand ");
   }

 if ((b == 0) && (a == 0));
 else
   {
    num (b);
    printf(" hundred ");
   }

 if (((a != 0) || (b != 0)) && ((c != 0) || (d != 0)))
   printf("and ");

 if ((c == 0) && (b == 0) && (a == 0))
   {
    if (d == 0)
      printf("zero");
   }
 else if (c == 1)
   switch (d)
   {
    case 0: printf("ten");
	      break;
    case 1: printf("eleven");
	      break;
    case 2: printf("twelve");
	      break;
    case 3: printf("thirteen");
	      break;
    case 4: printf("fourteen");
	      break;
    case 5: printf("fifteen");
	      break;
    case 6: printf("sixteen");
	      break;
    case 7: printf("seventeen");
	      break;
    case 8: printf("eighteen");
	      break;
    case 9: printf("nineteen");
	      break;
   }
 else
   switch (c)
   {
    case 0: break;
    case 2: printf("twenty");
	      break;
    case 3: printf("thirty");
	      break;
    case 4: printf("forty");
	      break;
    case 5: printf("fifty");
	      break;
    case 6: printf("sixty");
	      break;
    case 7: printf("seventy");
	      break;
    case 8: printf("eighty");
	      break;
    case 9: printf("ninety");
	      break;
   }

 if ((c != 0) && (d == 0));

 if ((c != 1) && (c != 0) && (d != 0))
   printf("-");

 if ((c != 1) && (d != 0))
   num (d);
}

num (x)
  int x;
{
  char name[10][6]={"","one","two","three","four","five","six","seven",
		    "eight","nine"};
   printf("%s", name[x]);
  }
