#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  int i = a.length() - 1;
  int j = b.length() - 1;
  while (a[i] == b[j] && i >= 0 && j >= 0) {
    i--;
    j--;
  }
  cout << i + j + 2;
}
