#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  int la = a.length();
  int lb = b.length();
  int cnt = 0, i, j;
  if (a == b) {
    cout << "0\n";
    return 0;
  }
  for (i = la - 1, j = lb - 1; i >= 0, j >= 0; i--, j--) {
    if (a[i] == b[j]) {
      cnt++;
    } else {
      break;
    }
  }
  la -= cnt;
  lb -= cnt;
  cout << la + lb << endl;
  return 0;
}
