Files
python/TangDou/LuoGuBook/P1229.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

18 lines
455 B
C++

#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;
}