Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- map<pair<string,string>, int> mp;
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- int t;
- cin>>t;
- set<string> st;
- while(t--){
- string s;
- cin>>s;
- int n = s.length();
- string from = s.substr(0,3);
- st.insert(from);
- for(int i = 1;i<n-2;i++){
- string to = s.substr(i,3);
- st.insert(to);
- mp[make_pair(from, to)]++;
- from = to;
- }
- }
- cout<<st.size()<<" "<<mp.size()<<endl;
- for(auto p : mp){
- cout<<p.first.first<<" "<<p.first.second<<" "<<p.second<<"\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement