#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  reverse(s.begin(), s.end());
  reverse(t.begin(), t.end());
  int i = 0;
  while (i < s.length() && i < t.length() && s[i] == t[i]) {
    i++;
  }
  cout << s.length() + t.length() - 2 * i;
}
