fork download
  1. # include <stdio.h>
  2.  
  3. int fuzzyStrcmp(char s[], char t[]){
  4. for(int i = 0; s[i] != '\0' && t[i] != '\0'; i++){
  5. char cs = s[i];
  6. char ct = t[i];
  7.  
  8. // 大文字 → 小文字
  9. if(cs >= 'A' && cs <= 'Z'){
  10. cs = cs + 32;
  11. }
  12. if(ct >= 'A' && ct <= 'Z'){
  13. ct = ct + 32;
  14. }
  15.  
  16. if(cs != ct){
  17. return 0;
  18. }
  19. }
  20.  
  21. // 長さチェック
  22. for(int i = 0; ; i++){
  23. if(s[i] == '\0' && t[i] == '\0'){
  24. return 1;
  25. }
  26. if(s[i] == '\0' || t[i] == '\0'){
  27. return 0;
  28. }
  29. }
  30. }
  31. int main(){
  32. int ans;
  33. char s[100];
  34. char t[100];
  35. scanf("%s %s",s,t);
  36. printf("%s = %s -> ",s,t);
  37. ans = fuzzyStrcmp(s,t);
  38. printf("%d\n",ans);
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0s 5328KB
stdin
abCD abCs
stdout
abCD = abCs -> 0