fork download
  1. #include <ctype.h>
  2. # include <stdio.h>
  3.  
  4. int fuzzyStrcmp(char s[], char t[]){
  5. int i = 0;
  6.  
  7. while(s[i] != '\0' && t[i] != '\0'){
  8. // 小文字に変換して比較
  9. if(tolower(s[i]) != tolower(t[i])){
  10. return 0; // 違う
  11. }
  12. i++;
  13. }
  14.  
  15. // 長さが違う場合
  16. if(s[i] != t[i]){
  17. return 0;
  18. }
  19.  
  20. return 1; // 同じ
  21. }
  22.  
  23. //メイン関数は書き換えなくてできます
  24. int main(){
  25. int ans;
  26. char s[100];
  27. char t[100];
  28. scanf("%s %s",s,t);
  29. printf("%s = %s -> ",s,t);
  30. ans = fuzzyStrcmp(s,t);
  31. printf("%d\n",ans);
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0s 5320KB
stdin
abCD AbCd
stdout
abCD = AbCd -> 1