#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string a, b;
  cin >> a >> b;
  int cnt(0);
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  for (int i = 0; i < max(a.size(), b.size()); i++) {
    if (a[i] != b[i]) break;
    cnt += 2;
  }
  cout << (a.size() + b.size()) - cnt << '\n';
  return 0;
}
