#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;
char a[maxn], c[maxn];
int main() {
  scanf("%s%s", a, c);
  int la = strlen(a), lb = strlen(c);
  int len = la + lb;
  int i, j;
  for (i = la - 1, j = lb - 1; i >= 0 && j >= 0; i--, j--) {
    if (a[i] == c[j]) {
      len -= 2;
    } else
      break;
  }
  printf("%d", len);
  return 0;
}
