#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s1, s2;
  cin >> s1 >> s2;
  int c = 0, i;
  int l1, l2;
  l1 = s1.length();
  l2 = s2.length();
  i = l1 - 1;
  int j = l2 - 1;
  while (i >= 0 && j >= 0 && s1[i--] == s2[j--]) c = c + 2;
  int cl = l1 + l2 - c;
  cout << cl;
}
