#include <bits/stdc++.h>
using namespace std;
int main() {
  string str1;
  string str2;
  cin >> str1;
  cin >> str2;
  int index2 = str2.length();
  int index1 = str1.length();
  while (index1 > 0 && index2 > 0) {
    if (str1[index1 - 1] == str2[index2 - 1]) {
      index1--;
      index2--;
    } else {
      break;
    }
  }
  cout << index1 + index2;
  return 0;
}
