fork download
  1. # include <stdio.h>
  2.  
  3. int fuzzyStrcmp(char s[], char t[]){
  4. //関数の中だけを書き換えてください
  5. //同じとき1を返す,異なるとき0を返す
  6. int i = 0;
  7. while (s[i] != '\0' && t[i] != '\0'){
  8. char cs = s[i];
  9. char ct = t[i];
  10.  
  11. if(cs >= 'A' && cs <= 'Z'){
  12. cs = cs + ('a' - 'A');
  13. }
  14. if(ct >= 'A' && ct <= 'Z'){
  15. ct = ct + ('a' - 'A');
  16. }
  17.  
  18. if (cs != ct){
  19. return 0;
  20. }
  21. i++;
  22. }
  23.  
  24. if (s[i] != '\0' || t[i] != '\0'){
  25. return 0;
  26. }
  27.  
  28. return 1;
  29. }
  30.  
  31. //メイン関数は書き換えなくてできます
  32. int main(){
  33. int ans;
  34. char s[100];
  35. char t[100];
  36. scanf("%s %s",s,t);
  37. printf("%s = %s -> ",s,t);
  38. ans = fuzzyStrcmp(s,t);
  39. printf("%d\n",ans);
  40. return 0;
  41. }
  42.  
Success #stdin #stdout 0s 5284KB
stdin
abCD 
AbCd
stdout
abCD = AbCd -> 1