#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  if (s1.length() < s2.length()) {
    string temp = s1;
    s1 = s2;
    s2 = temp;
  }
  int cnt = 0;
  for (int i = s1.length() - 1, j = s2.length() - 1; j >= 0; i--, j--) {
    if (s1[i] == s2[j]) {
      cnt++;
    } else
      break;
  }
  int ans = s1.length() - cnt + s2.length() - cnt;
  cout << ans << endl;
  return 0;
}
