|  | 
|  | 
| back to board | use the map Posted by aybek  17 Oct 2013 16:08I think that code is easy to understand.If you got WA, try it.
 
 #include <iostream>
 #include <map>
 using namespace std;
 
 int main() {
 map<char, string> m;
 
 int n; cin >> n;
 while (n--) {
 char c1, c2; cin >> c1 >> c2;
 m[c1].push_back(c2);
 }
 char c; cin >> c;
 for (int i = 0; i < m[c].size(); ++i)
 cout << c << m[c][i] << endl;
 
 return 0;
 }
 | 
 | 
|