#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, min1, count = 0, sum;
  string a, b;
  cin >> a >> b;
  n = a.size();
  m = b.size();
  sum = n + m;
  min1 = min(n, m);
  for (int i = min1 - 1; i >= 0; i--) {
    if (m > 0 && n > 0 && a[--n] == b[--m])
      count++;
    else
      break;
  }
  cout << sum - 2 * count << endl;
  return 0;
}
