#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
template <typename T, typename U>
static void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T>
void sout(T &w) {
  for (auto x : w) cout << x << " ";
  cout << endl;
}
int main() {
  string a, b;
  cin >> a >> b;
  if (a.size() < b.size()) swap(a, b);
  int res = a.size() - b.size();
  a = a.substr(a.size() - b.size(), a.size());
  int n = a.size();
  int i = n - 1;
  while (i >= 0 && a[i] == b[i]) --i;
  cout << res + ((i + 1) << 1);
}
