#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, p;
  cin >> s >> p;
  int l1 = s.length();
  int l2 = p.length();
  int i, j;
  int c = 0;
  for (i = l1 - 1, j = l2 - 1; i >= 0 && j >= 0; i--, j--) {
    if (s[i] == p[j]) {
      c++;
      continue;
    } else {
      break;
    }
  }
  int ans = (l1 + l2) - (2 * c);
  cout << ans;
  return 0;
}
