#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string s, t;
  cin >> s >> t;
  int count = 0;
  int i = s.length() - 1;
  int j = t.length() - 1;
  while (s[i] == t[j] && i >= 0 && j >= 0) {
    i -= 1;
    j -= 1;
    count += 1;
  }
  cout << (s.length() + t.length() - 2 * count);
  return 0;
}
