麻烦各位大佬帮忙看看我的代码错在哪里了
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e4 + 5;
int n;
map<string, string>m;
string s, ans;
signed main() {
cin >> n;
for (int i = 1; i <= n; i++) {
string a, b;
cin >> a >> b;
m[a] = b;
}
cin >> s;
s += '.';
string t = "";
for (char c : s) {
if (c >= 'a' && c <= 'z') {
t += c;
} else {
if (t != "") {
if (m.count(t)) {
ans += m[t];
} else {
ans += "UNK";
t = "";
}
}
ans += c;
}
}
ans.pop_back();
cout << ans << endl;
return 0;
}
提交记录
(@tder,你的题解到底能不能AC啊?)