fork download
  1. # include <stdio.h>
  2. int count(char s[], char t[]) {
  3. int i = 0;
  4. int j = 0;
  5. while (s[i] != '\0') {
  6. i++;
  7. }
  8. while (t[j] != '\0') {
  9. j++;
  10. }
  11. return i == j;
  12. }
  13.  
  14. int fuzzyStrcmp(char s[], char t[]) {
  15. int i;
  16.  
  17. if (!count(s, t)) {
  18. return 0;
  19. }
  20. for (i = 0; s[i] != '\0'; i++) {
  21. char a = s[i];
  22. char b = t[i];
  23. if (a >= 'A' && a <= 'Z') {
  24. a = a - 'A' + 'a';
  25. }
  26. if (b >= 'A' && b <= 'Z') {
  27. b = b - 'A' + 'a';
  28. }
  29. if (a != b) {
  30. return 0;
  31. }
  32. }
  33. return 1;
  34. }
  35. //メイン関数は書き換えなくてできます
  36. int main(){
  37. int ans;
  38. char s[100];
  39. char t[100];
  40. scanf("%s %s",s,t);
  41. printf("%s = %s -> ",s,t);
  42. ans = fuzzyStrcmp(s,t);
  43. printf("%d\n",ans);
  44. return 0;
  45. }
  46.  
Success #stdin #stdout 0s 5332KB
stdin
abCD AbCD
stdout
abCD = AbCD -> 1