#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e6 + 7;
int main() {
  string s, t;
  cin >> s >> t;
  string a = s, b = t;
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  int l = min(a.size(), b.size());
  int id = 0;
  for (int i = 0; i < (int)l + 1; i++) {
    if (a[i] != b[i]) {
      id = i;
      break;
    }
  }
  int ans = a.size() - id;
  ans += b.size() - (id);
  if (a == b) ans = 0;
  cout << ans << endl;
}
