#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int main() {
  cin >> s1 >> s2;
  int len1 = s1.length();
  int len2 = s2.length();
  int cnt = 0;
  for (int i = len1 - 1, j = len2 - 1; i >= 0, j >= 0; i--, j--) {
    if (s1[i] == s2[j]) {
      cnt += 2;
    } else
      break;
  }
  cout << len1 + len2 - cnt << endl;
}
