fork(3) download
  1. #include <stdio.h>
  2.  
  3. int strEqualsIgnoreCase(char *s, char *t) {
  4. while (*s && *s == *t) {
  5. if (*s == '\0') return 1;
  6. s++; t++;
  7. }
  8. return 0;
  9. }
  10.  
  11. void toUpperCase(char *s) {
  12. while (*s) {
  13. if ('a' <= *s && *s <= 'z') *s -= 32;
  14. s++;
  15. }
  16. }
  17.  
  18. int fuzzyCompare(char *s, char *t) {
  19. toUpperCase(s);
  20. toUpperCase(t);
  21. return strEqualsIgnoreCase(s, t);
  22. }
  23.  
  24. int main() {
  25. char s[100], t[100];
  26. scanf("%s %s", s, t);
  27. printf("%s = %s -> %d\n", s, t, fuzzyCompare(s, t));
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5288KB
stdin
AbcD aBcD
stdout
ABCD = ABCD -> 0