#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string a, b;
  cin >> a >> b;
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  int cnt = 0;
  while (cnt != a.size() && cnt != b.size() && a[cnt] == b[cnt]) {
    cnt++;
  }
  cout << a.size() - cnt + b.size() - cnt << endl;
  return 0;
}
