fork download
  1. #include <stdio.h>
  2.  
  3. char myToUpper(char c){
  4. if(c >='a' && c <='z'){
  5. return c-('a'-'A');
  6. }else{
  7. return c;
  8. }
  9. }
  10.  
  11. int fuzzyStrcmp(char s[], char t[]){
  12. int i;
  13. for(i =0; s[i] !='\0' || t[i] !='\0'; i++){
  14. if (myToUpper(s[i]) != myToUpper(t[i])){
  15. return 0;
  16. }
  17. }
  18.  
  19. if(s[i] =='\0' && t[i] =='\0'){
  20. return 1;
  21. }else{
  22. return 0;
  23. }
  24. }
  25.  
  26. int main(){
  27. int ans;
  28. char s[100];
  29. char t[100];
  30. scanf("%s %s",s,t);
  31. printf("%s = %s -> ",s,t);
  32. ans = fuzzyStrcmp(s,t);
  33. printf("%d\n", ans);
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0.01s 5296KB
stdin
abCD AbCd
stdout
abCD = AbCd -> 1