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