fork download
  1. #include <bits/stdc++.h>
  2. #include <string.h>
  3. using namespace std;
  4. #define ll long long
  5.  
  6. void solve(){
  7. string s1,s2;cin>>s1>>s2;
  8. map<int,int>freq1,freq2;int ans=(int)s1.size();
  9. for(int i=0;i<(int)s1.size();i++){freq1[s1[i]-'a']++;}
  10. for(int i=0;i<(int)s2.size();i++){freq2[s2[i]-'a']++;}
  11. for(int i=0;i<26;i++){if(freq2[i]>freq1[i]){ans+=freq2[i]-freq1[i];}}
  12. cout<<ans<<endl;
  13. }
  14. int main() {
  15. int t;
  16. cin>>t;
  17. while(t--)solve();
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5284KB
stdin
5
aba
cb
er
cf
mmm
mmm
contest
test
cde
abcefg
stdout
4
4
3
7
7