fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void)
  5. {
  6. char str1[51], str2[51];
  7. int i, c, j;
  8.  
  9. while(scanf("%s", str1)!=EOF)
  10. {
  11. j=0;
  12. scanf("%s", str2);
  13. for(i=0; i<strlen(str1); i++)
  14. {
  15. for(c=0; c<strlen(str2); c++)
  16. {
  17. if(str1[i]==str2[c])
  18. {
  19. j++;
  20. continue;
  21. }
  22. }
  23. }
  24. printf("%d\n", j);
  25. }
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 2116KB
stdin
abcdef
cdofhij
stdout
3