這程式哪裡有問題?
# include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
/*
解題重點 (From 解題報告) :
string s = "abyyyab";
=> ab|yyy|ab
=> A | B | A (找 B 是否存在)
string s = "stupid";
=> 無法分段成 ABA
=> 無法配對 (保證不會有兩支籤一樣)
*/
int n; cin >> n;
vector<string> Lucky(n);
for (int i=0; i<n; i++) cin >> Lucky[i];
int ans=0;
for (int i=0; i<n; i++){
string S = Lucky[i];
bool Check=false; int Index;
for (int j=1; j<=S.size()/2; j++){
string a=S.substr(0,j), b=S.substr(S.size()-j,j);
if (a != b) continue;
else {Check=true; Index=j; break;}
}
if (Check){
string Find = S.substr(Index,S.size()-Index*2);
for (int k=0; k<n; k++){
if (Lucky[k] == Find) {ans++; break;}
}
}
}
cout << ans << '\n';
return 0;
}