#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s_len, t_len, i, j, count = 0, out;
  string s, t;
  cin >> s;
  cin >> t;
  s_len = s.length();
  t_len = t.length();
  i = s_len - 1;
  j = t_len - 1;
  while ((i >= 0) && (j >= 0)) {
    if (s[i] != t[j]) break;
    count++;
    i--;
    j--;
  }
  out = (s_len - count) + (t_len - count);
  cout << out << endl;
  return 0;
}
