#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int INF = 1e9 + 7;
string s, t;
int res;
int main() {
  cin >> s >> t;
  reverse(s.begin(), s.end());
  reverse(t.begin(), t.end());
  int i = 0;
  while (s[i] == t[i] && i < min(t.size(), s.size())) {
    res += 2;
    ++i;
  }
  cout << t.size() + s.size() - res;
}
