#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s, t;
  cin >> s >> t;
  long long mt = 0;
  for (long long i = s.length() - 1, j = t.length() - 1;; i--, j--) {
    if (s[i] == t[j]) {
      mt++;
    } else {
      break;
    }
    if (i == 0 || j == 0) {
      break;
    }
  }
  cout << s.length() + t.length() - 2 * mt << endl;
}
void testcase() {
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
