Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <map>
- #include <algorithm>
- #include <set>
- #include <cmath>
- #include <fstream>
- #include <string>
- #include <iomanip>
- #include <queue>
- #include <stack>
- #include <deque>
- #include <unordered_map>
- #include <unordered_set>
- using namespace std;
- #define ll long long
- #define f first
- #define s second
- #define mp make_pair
- #define pb push_back
- #define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
- #define all(a) a.begin(), a.end()
- #define PI 3.141592653589793238462643383279502884197169399375105820974
- typedef vector <pair <int ,int > > vpii;
- typedef vector <pair <ll ,ll > > vpll;
- typedef vector <pair <double ,double > > vpdd;
- typedef vector<int> vi;
- typedef vector <ll> vl;
- typedef vector <char> vc;
- typedef vector <double> vd;
- typedef pair <int, int> pii;
- typedef pair <ll, ll> pll;
- typedef pair <double, double> pdd;
- int main() {
- //freopen("input.txt", "r", stdin);
- // freopen("output.txt", "w", stdout);
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- ll n;
- cin >> n;
- vector<string> a(n);
- map<pair <string, string>, ll> b;
- set<string> arr;
- for(int i = 0; i < n; i++){
- cin >> a[i];
- }
- for(int i = 0; i < n; i++){
- for(int j = 0; j < a[i].size() - 3; j++){
- string s1, s2;
- s1 = a[i].substr(j, 3);
- //cout << "#" << s1 << endl;
- s2 = a[i].substr(j + 1, 3);
- //cout << "*" << s2 << endl;
- b[{s1, s2}]++;
- arr.insert(s1);
- arr.insert(s2);
- }
- }
- ll ans1, ans2;
- ans1 = 0;
- ans2 = 0;
- ans1 = b.size();
- for(auto it : b){
- if(it.f.f != it.f.s){
- ans2 += 2;
- }
- else{
- ans2++;
- }
- //cout << it.f.f << ' ' << it.f.s << ' ' << it.s << endl;
- }
- cout << arr.size()<< endl;
- cout << ans1 << endl;
- for(auto it : b){
- cout << it.f.f << ' ' << it.f.s << ' ' << it.s << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement