#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<char> first, second;
  string firsts, seconds;
  cin >> firsts;
  cin >> seconds;
  int firstSize = firsts.length();
  int secondSize = seconds.length();
  for (int i = 0; i < firstSize; ++i) {
    first.push_back(firsts[i]);
  }
  for (int i = 0; i < secondSize; ++i) {
    second.push_back(seconds[i]);
  }
  int answer = 0;
  while (firstSize > secondSize) {
    firstSize--;
    first.erase(first.begin());
    answer++;
  }
  while (secondSize > firstSize) {
    secondSize--;
    second.erase(second.begin());
    answer++;
  }
  int temp = 0;
  for (int i = 0; i < first.size(); ++i) {
    if (first[i] == second[i])
      temp++;
    else {
      temp = 0;
    }
  }
  answer += 2 * (firstSize - temp);
  cout << answer;
  return 0;
}
