#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  reverse(s.begin(), s.end());
  reverse(t.begin(), t.end());
  if (s[0] != t[0])
    cout << s.size() + t.size() << endl;
  else {
    int i = 1, l = min(s.size(), t.size());
    for (; i < l; i++) {
      if (s[i] == t[i])
        continue;
      else
        break;
    }
    cout << s.size() - i + t.size() - i << endl;
  }
  return 0;
}
