#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(vector<T> &v) {
  for (auto &a : v) cin >> a;
}
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int n = s1.size(), m = s2.size(), i, j;
  for (i = n - 1, j = m - 1; i >= 0 && j >= 0; i--, j--)
    if (s1[i] != s2[j]) break;
  cout << (i + j + 2) << endl;
  return 0;
}
