fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int c=0;
  6. string s,a;
  7. cin >> s >> a;
  8. int n = s.size();
  9. int t = a.size();
  10. if(s<a)
  11. {
  12. for(int i=n-1;i>=0;i--)
  13. {
  14. if(s[i]==a[i])
  15. {
  16. c++;
  17. }
  18. }
  19.  
  20. cout << (n+t-2*c) << endl;
  21. }
  22. else
  23. {
  24. for(int i=t-1;i>=0;i--)
  25. {
  26. if(s[i]==a[i])
  27. {
  28. c++;
  29. }
  30. }
  31.  
  32. cout << (n+t-2*c) << endl;
  33. }
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5288KB
stdin
codeforces
yes

stdout
13