#include <bits/stdc++.h>
using namespace std;
int main() {
  long long tc, x, y, z, b, c, d, e, k, p, q = 0, r, n, m, i, j;
  long long a[4] = {1, 3, 20, 7};
  string s, t, ss = "ABC";
  char ch;
  vector<char> u, v;
  set<char> st;
  set<char>::iterator it;
  map<char, long long> mp;
  cin >> s >> t;
  n = s.length();
  m = t.length();
  i = n - 1;
  j = m - 1;
  while (i >= 0 && j >= 0) {
    if (s[i] == t[j])
      q++;
    else
      break;
    i--;
    j--;
  }
  cout << n - q + m - q << endl;
}
