fork download
  1. # include <stdio.h>
  2.  
  3. int fuzzyStrcmp(char s[], char t[]){
  4. int i = 0;
  5. while (s[i] != '\0' && t[i] != '\0') {
  6. if (tolower(s[i]) != tolower(t[i])) {
  7. return 0; // どこか一文字でも違えば異なる
  8. }
  9. i++;
  10. }
  11. // 両方の文字列が同じ長さで終わっていれば同じ
  12. if (s[i] == '\0' && t[i] == '\0') {
  13. return 1;
  14. } else {
  15. return 0;
  16. }
  17. }
  18.  
  19. //メイン関数は書き換えなくてできます
  20. int main(){
  21. int ans;
  22. char s[100];
  23. char t[100];
  24. scanf("%s %s",s,t);
  25. printf("%s = %s -> ",s,t);
  26. ans = fuzzyStrcmp(s,t);
  27. printf("%d\n",ans);
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0.01s 5288KB
stdin
abCD AbCd
stdout
abCD = AbCd -> 1