#include <bits/stdc++.h>
using namespace std;
char a[300000], b[300000];
int main() {
  scanf("%s%s", a, b);
  int ans = strlen(a) + strlen(b);
  for (int i = 1; i <= min(strlen(a), strlen(b)); i++)
    if (a[strlen(a) - i] == b[strlen(b) - i])
      ans -= 2;
    else
      break;
  printf("%d", ans);
  return 0;
}
