title: accepting case-insensitive input and printing them out correctly
body: <p>Hi guys I wrote a better and improved hangman game that accepts lowercase input and uppercase input.
  The only problem that I have is that for example if the String looks like this "tnt" it prints out every character big in the console. I am trying to make it print out the exact same string.
  So if I input big 'T' then it should accept it and output small 't'.</p>
  
  <p>Could someone help me?</p>
  
  <p>Thank you in advance.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdbool.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  #define MAX_WORD 100
  
  int get_word(char *word, int size) {
      fgets(word, size, stdin);
      int len = strlen(word);
      if (len &amp;&amp; word[len - 1] == '\n')
          word[--len] = '\0';
      for (int i = 0; i &lt; len; ++i)
          if (isalpha(word[i]))
              word[i] = toupper(word[i]);
          else
              return -1;
      return len;
  }
  
  void create_output(char *output, int len) {
      for (int i = 0; i &lt; len; ++i)
          output[i] = '_';
      output[len] = '\0';
  }
  
  void print_output(const char *output, const char *alpha, int tries) {
      printf("(%d)  ", tries);
      for (int i = 0; output[i]; ++i)
          printf("%c ", output[i]);
      printf("  %s\n", alpha);
  }
  
  bool play_game(const char *word, int len) {
      char alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      char output[MAX_WORD];
      create_output(output, len);
      int tries = 0, guessed = 0;
      while (tries &lt; len &amp;&amp; guessed &lt; len) {  // using word length for number of tries (?!)
          print_output(output, alpha, tries);
          printf("Guess: ");
          char guess;
          scanf(" %c", &amp;guess);
          guess = toupper(guess);
          if (alpha[guess - 'A'] != ' ') {
              for (int i = 0; i &lt; len; ++i)
                  if (word[i] == guess &amp;&amp; output[i] == '_') {
                      output[i] = word[i];
                      ++guessed;
                  }
              alpha[guess - 'A'] = ' ';
              ++tries;
          }
      }
      print_output(output, alpha, tries);
      return guessed == len;
  }
  
  int main() {
      printf("Enter word to guess: ");
      char word[MAX_WORD];
      int len = get_word(word, sizeof word);
      if (len == -1) {
          printf("The word cannot contain spaces.\n");
          return EXIT_FAILURE;
      }
      if (play_game(word, len))
          printf("You win!\n");
      else
          printf("You lose.\nThe word was %s.\n", word);
      return 0;
  } 
  </code></pre>