#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  int i;
  for (i = 0; i < min(a.size(), b.size()); i++)
    if (a[i] != b[i]) break;
  cout << a.size() - i + b.size() - i;
  return 0;
}
