#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
string s, t;
cin >> s >> t;
int n = s.length();
int m = t.length();
long long ans = 0;
for (int i = -m + 1; i < n; i++)
{
int cnt = 0;
for (int j = 0; j < t.length(); j++)
{
if (i + j < 0 || i + j > s.length())
continue;
if (t[j] == s[i + j])
cnt++;
else
{
ans += cnt * (cnt + 1) / 2;
cnt = 0;
}
}
ans += cnt * (cnt + 1) / 2;
}
cout << ans << endl;
}