fork download
  1. # include <stdio.h>
  2. # include <ctype.h> // for tolower()
  3.  
  4. int fuzzyStrcmp(char s[], char t[]) {
  5. int i = 0;
  6. while (s[i] != '\0' && t[i] != '\0') {
  7. // 大文字小文字を区別せずに比較
  8. if (tolower(s[i]) != tolower(t[i])) {
  9. return 0;
  10. }
  11. i++;
  12. }
  13.  
  14. // 両方とも終端文字 '\0' に到達していれば一致と判断
  15. return (s[i] == '\0' && t[i] == '\0') ? 1 : 0;
  16. }
  17.  
  18.  
  19. int main(){
  20. int ans;
  21. char s[100];
  22. char t[100];
  23. scanf("%s %s",s,t);
  24. printf("%s = %s -> ",s,t);
  25. ans = fuzzyStrcmp(s,t);
  26. printf("%d\n",ans);
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 5316KB
stdin
abCD AbCd
stdout
abCD = AbCd -> 1