#include <bits/stdc++.h>
using namespace std;
int main() {
  string str1, str2;
  int i, j;
  cin >> str1 >> str2;
  int l1 = str1.size();
  int l2 = str2.size();
  while (l1 >= 0 && l2 >= 0 && str1[l1] == str2[l2]) {
    l1--;
    l2--;
  }
  cout << l1 + l2 + 2;
  return 0;
}
