fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. string a,b; cin >> a >> b;
  6. if(a.size() > b.size()) swap(a,b);
  7. int op = b.size() + a.size(), dif = b.size() - a.size();
  8. for(int i=a.size()-1;i>=0;--i){
  9. if(a[i] == b[i+dif]) op -= 2;
  10. else break;
  11. }
  12. cout << op;
  13. return 0;
  14. }
Success #stdin #stdout 0s 5224KB
stdin
codeforces


stdout
10