fork download
  1. #include<string.h>
  2. int main()
  3. {
  4. int t;scanf("%d",&t);
  5. int i,j,k;
  6. char str1[10001],str2[10001];
  7. while(t--)
  8. {
  9. scanf("%s%s",str1,str2);
  10. int l1=strlen(str1);
  11. int l2=strlen(str2);
  12. int f1[125]={0},f2[125]={0};
  13. int count=0;
  14. for(i=0;i<l1;i++)
  15. {
  16. f1[str1[i]]++;
  17. }
  18. for(i=0;i<l2;i++)
  19. {
  20. f2[str2[i]]++;
  21. }
  22. for(i=48;i<=125;i++)
  23. {
  24. if(f1[i]>0 && f2[i]>0)
  25. {
  26. if(f1[i]>f2[i])
  27. {
  28. count=count+f2[i];
  29. }
  30. else
  31. {
  32. count=count+f1[i];
  33. }
  34. }
  35. }
  36. printf("%d\n",count);
  37. }
  38. return 0;
  39. }
  40.  
  41.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
Standard output is empty