#include <bits/stdc++.h>
using namespace std;
string s1, s2;
long long nmin, i, c, n1, n2, n3;
int main() {
  cin >> s1 >> s2;
  n1 = s1.length();
  n2 = s2.length();
  n3 = n2 + n1;
  nmin = min(n1, n2);
  for (i = 0; i < nmin; i++) {
    if (s1[n1 - i - 1] == s2[n2 - 1 - i])
      c += 2;
    else
      break;
  }
  cout << n3 - c;
  return 0;
}
