#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
char s[maxn], t[maxn];
int num = 0;
int main() {
  for (int i = 0; i < 2e5 + 5; i++) s[i] = '@', t[i] = '@';
  cin >> s >> t;
  int len1 = strlen(s);
  int len2 = strlen(t);
  if (s[len1 - 1] != t[len2 - 1]) {
    cout << len1 + len2 << endl;
    return 0;
  }
  reverse(s, s + len1);
  reverse(t, t + len2);
  for (int i = 0; i < max(len1, len2); i++) {
    if (s[i] == t[i])
      num += 2;
    else
      break;
  }
  cout << len1 + len2 - num << endl;
  return 0;
}
