#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s;
  cin >> t;
  long int n, m, sum;
  n = s.size();
  m = t.size();
  long int count = 0;
  if (s.size() == 0 && t.size() == 0) {
    cout << 0;
  } else if (s.size() == 0 && t.size() != 0) {
    cout << t.size();
  } else if (t.size() == 0 && s.size() != 0) {
    cout << s.size();
  } else if (s == t) {
    cout << 0;
  } else {
    while (s[n - 1] == t[m - 1]) {
      count++;
      n--;
      m--;
    }
    sum = (s.size() - count) + (t.size() - count);
    cout << sum;
  }
  return 0;
}
