Computer Programming Contest Preparation

ToolBox - Source for: 117/11713/a.c



/home/toolbox/public_html/solutions/117/11713/a.c
    1 #include <stdio.h>
    2 #include <string.h>
    3 #include <sys/types.h>
    4 #include <sys/stat.h>
    5 #include <fcntl.h>
    6 #include <stdlib.h>
    7 #include <math.h>
    8 #include <stdint.h>
    9 #include <ctype.h>
   10 
   11 #define TRUE  (1 == 1)
   12 #define FALSE (1 != 1)
   13 
   14 #define DEBUG if (FALSE)
   15 
   16 /* fprintf(stderr, "functionName: message", varslist); */
   17 
   18 /*
   19  *  Author: Isaac Traxler
   20  *    Date: 2021-12-7
   21  * Purpose: fun
   22  * Problem: 11713 - Abstract Names
   23  */
   24 
   25 /*
   26  * This template reads data a specified number of times.
   27  */
   28 
   29 #define MAX_NAME 30
   30 #define REPLACE '|'
   31 
   32 int numberOfTimes;
   33 char n1[MAX_NAME];
   34 char n2[MAX_NAME];
   35 
   36 void init()
   37 {
   38     /* FUNCTION init */
   39     scanf("%d ", &numberOfTimes);
   40 } /* FUNCTION init */
   41 
   42 void dump()
   43 {
   44     /* FUNCTION dump */
   45 } /* FUNCTION dump */
   46 
   47 void getInput()
   48 {
   49     /* FUNCTION getInput */
   50     scanf(" %s %s ", n1, n2);
   51 } /* FUNCTION getInput */
   52 
   53 void fix(char name[])
   54 {
   55     /* FUNCTION fix */
   56     int i;
   57     int slen;
   58 
   59     slen = strlen(name);
   60     for (i=0; slen>i; i++)
   61         {
   62             /* for each char */
   63             if (('a' == name[i]) ||
   64                     ('e' == name[i]) ||
   65                     ('i' == name[i]) ||
   66                     ('o' == name[i]) ||
   67                     ('u' == name[i]))
   68                 {
   69                     /* change letter */
   70                     name[i] = REPLACE;
   71                 } /* change letter */
   72         } /* for each char */
   73 } /* FUNCTION fix */
   74 
   75 void process()
   76 {
   77     /* FUNCTION process */
   78     if (strlen(n1) == strlen(n2))
   79         {
   80             /* fix them */
   81             fix(n1);
   82             fix(n2);
   83             if (0 == strcmp(n1, n2))
   84                 {
   85                     printf("Yes\n");
   86                 }
   87             else
   88                 {
   89                     printf("No\n");
   90                 }
   91         } /* fix them */
   92     else
   93         {
   94             printf("No\n");
   95         }
   96 } /* FUNCTION process */
   97 
   98 int main()
   99 {
  100     /* main */
  101     int i;
  102 
  103     init();
  104     for (i=0; i<numberOfTimes; i++)
  105         {
  106             /* while */
  107             getInput();
  108             process();
  109         } /* while */
  110 
  111     return EXIT_SUCCESS;
  112 } /* main */
  113 
  114