#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  int count = 0, aHp = a.length(), bHp = b.length();
  while (min(aHp, bHp) > 0) {
    if (a.at(aHp - 1) == b.at(bHp - 1)) {
      count++;
    } else {
      break;
    }
    aHp--;
    bHp--;
  }
  int difA = a.length() - count, difB = b.length() - count;
  cout << difA + difB;
}
