#include <bits/stdc++.h>
int main() {
  char a1[200001];
  char a2[200001];
  int len1, len2, c;
  gets(a1);
  gets(a2);
  len1 = strlen(a1);
  len2 = strlen(a2);
  if (len1 > len2) {
    for (int i = (len2 - 1); i >= 0; --i)
      if (a2[i] == a1[i + (len1 - len2)])
        c = c + 2;
      else
        break;
  } else {
    for (int i = (len1 - 1); i >= 0; --i)
      if (a1[i] == a2[i + (len2 - len1)])
        c = c + 2;
      else
        break;
  }
  printf("%d", ((len1 + len2) - c));
  return 0;
}
