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