Ad
  • Custom User Avatar

    Ah right thanks lol; also noted!

  • Default User Avatar

    Note that it is undefined behavior to use the ctype.h functions with a char, these functions are supposed to take unsigned chars as arguments

  • Custom User Avatar

    You should avoid the use of the ctype.h header and its functions like tolower. The behavior of these functions can change based on locale. It's not an issue here since the tests run on the server with the same locale, but it's a problem when running code on other computers. You can either change the locale using setlocale, or write your own tolower.

  • Custom User Avatar

    Subtracting a size_t from a size_t is not well-defined when the result is negative. You should compare them first to ensure that the result is positive before subtracting them. Also, the use of the ternary operator here is just not necessary.