#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int sum = 0;
  int p = max(s1.size(), s2.size()), x = min(s1.size(), s2.size());
  if (s1.size() > s2.size()) {
    string s3 = s2;
    for (int i = 1; i <= p - x; i++) {
      s3 = ' ' + s3;
    }
    for (int i = p - 1; i >= 0; i--) {
      if (s1[i] == s3[i]) {
        sum++;
        continue;
      } else
        break;
    }
  } else {
    string s3 = s1;
    for (int i = 1; i <= p - x; i++) {
      s3 = ' ' + s3;
    }
    for (int i = p - 1; i >= 0; i--) {
      if (s2[i] == s3[i]) {
        sum++;
        continue;
      } else
        break;
    }
  }
  cout << s1.size() + s2.size() - sum * 2;
  return 0;
}
