#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e;
int ar[200100];
int ar1[200100];
int main() {
  vector<int> arr(200100);
  string s, s1;
  cin >> s;
  cin >> s1;
  a = min(s.length(), s1.length());
  b = a;
  c = 1;
  while ((c <= a) && (s[s.length() - c] == s1[s1.length() - c])) ++c;
  cout << (a - c + 1) + max(s.length(), s1.length()) - c + 1;
}
