#include <bits/stdc++.h>
using namespace std;
char a[10000010];
char b[10000010];
int main() {
  scanf("%s%s", a, b);
  int sum = 0, min;
  int len1 = strlen(a), len2 = strlen(b);
  min = len1;
  if (len1 > len2) min = len2;
  for (int i = 0; i < min; i++) {
    if (a[len1 - i - 1] == b[len2 - i - 1])
      sum++;
    else
      break;
  }
  cout << len1 - sum + len2 - sum << endl;
}
