#include <bits/stdc++.h>
using namespace std;
const long long modn = (long long)1e9 + 7;
inline long long mod(long long x) { return x % modn; }
int main() {
  ios::sync_with_stdio(0);
  string s1, s2;
  long long ans = 0;
  cin >> s1 >> s2;
  if (s1.size() < s2.size()) {
    string tmp = s1;
    s1 = s2;
    s2 = tmp;
  }
  int ms = s2.size();
  int i, j;
  i = j = 0;
  int sz1 = s1.size();
  int sz2 = s2.size();
  while (s1[sz1 - i - 1] == s2[sz2 - j - 1] && (sz2 - j)) {
    i++;
    j++;
  }
  printf("%d\n", (sz1 - i) + (sz2 - j));
  return 0;
}
