fork download
  1. # include <stdio.h>
  2.  
  3. int fuzzyStrcmp(char s[], char t[]){
  4. //関数の中だけを書き換えてください
  5. //同じとき1を返す,異なるとき0を返す
  6. int ok = 1, d='A'-'a';
  7. if (d<0) d *= -1;
  8. for(int i=0;s[i]!='\0' && t[i]!='\0';i++){
  9. if('a' <= s[i] && s[i] <= 'z'){
  10. if(s[i]-d==t[i] || s[i]==t[i]) continue;
  11. }else{
  12. if(s[i]+d==t[i] || s[i]==t[i]) continue;
  13. }
  14. ok = 0;
  15. }
  16. return ok;
  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. printf("%d %d\n",'a','A');
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 5320KB
stdin
abCD AbCd
stdout
abCD = AbCd -> 1
97 65