1 solutions
-
0
C++ :
#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; } // cout<<c<<" "<<ans<<" "<<t<<endl; } ans.pop_back(); cout<<ans<<endl; return 0; }
- 1
Information
- ID
- 9164
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By