#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)(1e5);
const int INF_I = (int)(1e9);
const long long INF_LL = (long long)(1e18);
template <typename T>
void info(T& v) {
  for (auto i : v) cout << i << ' ';
  cout << '\n';
}
template <typename T>
bool chkmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chkmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
void boot_up() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios_base::sync_with_stdio(false);
}
string s, t;
void solve() {
  int n = ((s).size());
  int m = ((t).size());
  int eq = 0;
  reverse((s).begin(), (s).end());
  reverse((t).begin(), (t).end());
  for (int i = 0; i < min(n, m); ++i) {
    if (s[i] != t[i]) break;
    ++eq;
  }
  cout << n + m - 2 * eq << '\n';
}
signed main() {
  boot_up();
  while (cin >> s >> t) solve();
}
