#include <bits/stdc++.h>
using namespace std;
long long int BIGMOD(long long int a, long long int p, long long int m) {
  long long int result = 1;
  long long int x = a;
  while (p) {
    if (p & 1) {
      result = (result * x) % m;
    }
    x = (x * x) % m;
    p = p >> 1;
  }
  return result;
}
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
void SieveOfEratosthenes(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
int main() {
  string str1, str2;
  cin >> str1 >> str2;
  int i = str1.length() - 1;
  int j = str2.length() - 1;
  while (1) {
    if (str1[i] == str2[j]) {
      i--;
      j--;
      if (i < 0 || j < 0) break;
    } else
      break;
  }
  cout << (i + j) + 2 << "\n";
  return 0;
}
