You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
455 B

#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int ans = 1;//最少一种中序排列
string a, B;
int main() {
cin >> a >> b;
for (int i = 0; i < a.size() - 1; i++) {
string t = a.substr(i, 2); // 截取相邻的两个字符串
reverse(t.begin(), t.end()); // 反转
if (b.find(t) != string::npos) ans *= 2; // 匹配成功则总数*2
}
cout << ans << endl;
return 0;
}