#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10, mod = 1e9 + 7;
const long long inf = 1e18;
template <typename A, typename B>
ostream& operator<<(ostream& out, pair<A, B> p) {
  out << "{ " << p.first << ", " << p.second << " }";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> v) {
  out << "[ ";
  for (int i = 0; i < int((v).size()); i++) {
    out << v[i];
    if (i != int((v).size()) - 1) out << " ,";
  }
  out << " ]";
  return out;
}
int dp[maxn], f[maxn], z[maxn];
long long ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie();
  string a, b;
  cin >> a >> b;
  for (int i = 1; i < int((b).size()); i++) {
    f[i] = f[i - 1];
    while (f[i] != 0 && b[f[i]] != b[i]) f[i] = f[f[i] - 1];
    f[i] += b[f[i]] == b[i];
  }
  int L = -1, R = -1;
  z[0] = int((b).size());
  for (int i = 1; i < int((b).size()); i++) {
    if (R <= i) {
      L = R = i;
      while (R < int((b).size()) && b[R] == b[R - i]) R++;
      z[i] = R - i;
    }
    z[i] = min(R - i, z[i - L]);
    while (i + z[i] < int((b).size()) && b[i + z[i]] == b[z[i]]) z[i]++;
    if (R < i + z[i]) L = i, R = i + z[i];
  }
  for (int i = 0; i < int((b).size()); i++) {
    dp[i] = max(f[i] == 0 ? 0 : dp[f[i] - 1], z[i + 1]);
  }
  int tmp = 0;
  for (int i = 0; i < int((a).size()); i++) {
    while (tmp != 0 && a[i] != b[tmp]) tmp = f[tmp - 1];
    tmp += a[i] == b[tmp];
    ans += tmp == 0 ? int((b).size()) : (int((b).size()) - dp[tmp - 1]);
  }
  int lcp = 0;
  while (lcp < int((a).size()) && lcp < int((b).size()) && a[lcp] == b[lcp])
    lcp++;
  for (int i = 0; i < int((b).size()); i++) {
    if (f[i] != 0 && i + 1 - f[i] <= lcp) ans++;
  }
  return cout << ans << endl, 0;
}
