#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int ans = 0;
  string::reverse_iterator it1, it2;
  it1 = s1.rbegin();
  it2 = s2.rbegin();
  while (it1 != s1.rend() && it2 != s2.rend() && (*it1 == *it2)) {
    ans++;
    it1++;
    it2++;
  }
  cout << (s1.size()) + (s2.size()) - 2 * ans;
  ;
}
