/*Solution for hw4 p3
 *This program counts the number of vowels and consonants in a user given word
 *and decides which number is bigger.
 *The program will read one character at a time,
 *until a new line character is reached.
 */

#include <stdio.h>
#include <math.h>
#include "simpio.h"

void main(){

  char c;        /* keeps track of the current character*/
  int vowels =0; /* number of vowels*/
  int cons   =0; /* number of consonants*/

  printf("Hog name: ");


  /*
   *The while loop will keep on reading until it finds the end of the line.
   *Every character that is a letter is tested whether it is a vowel.
   *If it is not, we can conclude it is a consonant
   */


  while((c=getchar())!='\n'){   
    if(((c>='a')&&(c<='z'))||((c>='A')&&(c<='Z'))){  /*only consider alphabet letters*/
      if ((c=='a')||(c=='A')||(c=='e')||(c=='E')||(c=='i')||(c=='I')||(c=='o')||(c=='O')||(c=='u')||(c=='U')){
	vowels++;
      }else{
	cons++; /*if its an alphabet letter and not a vowel, its a consonant*/
      }
    }
  }

  if(vowels>cons){
    printf("This one will win \n");
  }else{
    printf("This one will lose \n");
  }

}








