#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string a, b;
  cin >> a >> b;
  reverse((a).begin(), (a).end());
  reverse((b).begin(), (b).end());
  long long int ans = 0;
  for (long long int i = 0; i < min(a.length(), b.length()); i++) {
    if (a[i] == b[i])
      ans++;
    else
      break;
  }
  cout << a.length() + b.length() - 2 * ans << '\n';
}
