#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, c = 0, ans, len;
  string s, t;
  cin >> s;
  cin >> t;
  len = min(s.length(), t.length());
  for (i = 1; i <= len; i++) {
    if (s[s.length() - i] == t[t.length() - i])
      c++;
    else
      break;
  }
  ans = s.length() + t.length() - 2 * c;
  cout << ans;
}
