func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int q;     cin >> q;     unordered_map<string, string> gr;     set<string> ending;     for (int i = 0; i < q; i++) {       string prev, next;       cin >> prev >> next;       gr[prev] = next;       ending.insert(next);     }     vector<pair<string, string>> ans;     for (auto it : gr) {       if (ending.count(it.first)) continue;       string cur = it.first;       while (gr.count(cur)) {         cur = gr[cur];       }       ans.push_back({it.first, cur});     }     cout << ans.size() <<   n ;     for (auto it : ans) cout << it.first <<     << it.second <<   n ;     return 0;   }   