#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s;
  cin >> t;
  int lenS = (int)s.size();
  int lenT = (int)t.size();
  int minLen = min(lenS, lenT);
  int identLen = 0;
  for (int i = 0; i < minLen; ++i) {
    if (s[lenS - 1 - i] == t[lenT - 1 - i]) {
      identLen++;
    } else {
      break;
    }
  }
  int maxLen = max(lenS, lenT);
  int steps = lenS + lenT - identLen * 2;
  cout << steps;
  return 0;
}
