文章
99
粉丝
120
获赞
8
访问
97.5k
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
using namespace std;
string s;
unordered_set<string> ss;
void dfs(int u, string str) {
if (u == s.size()) {
ss.insert(str);
return;
}
if (s[u] == '[') {
int j = u;
while (s[j] != ']') j++;
for (int i = u + 1; i < j; i++) {
str += s[i];
dfs(j + 1, str);
str.erase(str.end() - 1);
}
} else {
str += s[u];
dfs(u + 1, str);
}
}
int main() {
string strs[1010];
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> strs[i];
}
cin >> s;
for (int i = 0; i < s.size(); i++) if (s[i] >= 'a' &&
s[i] <= 'z') s[i] = s[i] - 32;
dfs(0, "");
for (int i = 0; i < n; i++) {
string sp = strs[i];
...
登录后发布评论
暂无评论,来抢沙发