#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b; cin >> a >> b;
if(a.size() > b.size()) swap(a,b);
int op = b.size() + a.size(), dif = b.size() - a.size();
for(int i=a.size()-1;i>=0;--i){
if(a[i] == b[i+dif]) op -= 2;
else break;
}
cout << op;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CglzdHJpbmcgYSxiOwljaW4gPj4gYSA+PiBiOwoJaWYoYS5zaXplKCkgPiBiLnNpemUoKSkJc3dhcChhLGIpOwoJaW50IG9wID0gYi5zaXplKCkgKyBhLnNpemUoKSwgZGlmID0gYi5zaXplKCkgLSBhLnNpemUoKTsKCWZvcihpbnQgaT1hLnNpemUoKS0xO2k+PTA7LS1pKXsKCQlpZihhW2ldID09IGJbaStkaWZdKQlvcCAtPSAyOwoJCWVsc2UJYnJlYWs7Cgl9CQoJY291dCA8PCBvcDsKCXJldHVybiAwOwp9