Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. #include <algorithm>
  5. #include <set>
  6. #include <cmath>
  7. #include <fstream>
  8. #include <string>
  9. #include <iomanip>
  10. #include <queue>
  11. #include <stack>
  12. #include <deque>
  13. #include <unordered_map>
  14. #include <unordered_set>
  15.  
  16. using namespace std;
  17.  
  18. #define ll long long
  19. #define f first
  20. #define s second
  21. #define mp make_pair
  22. #define pb push_back
  23. #define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
  24. #define all(a) a.begin(), a.end()
  25. #define PI 3.141592653589793238462643383279502884197169399375105820974
  26.  
  27. typedef vector <pair <int ,int > > vpii;
  28. typedef vector <pair <ll ,ll > > vpll;
  29. typedef vector <pair <double ,double > > vpdd;
  30. typedef vector<int> vi;
  31. typedef vector <ll> vl;
  32. typedef vector <char> vc;
  33. typedef vector <double> vd;
  34. typedef pair <int, int> pii;
  35. typedef pair <ll, ll> pll;
  36. typedef pair <double, double> pdd;
  37.  
  38.  
  39. int main() {
  40. //freopen("input.txt", "r", stdin);
  41. // freopen("output.txt", "w", stdout);
  42. ios_base::sync_with_stdio(false);
  43. cin.tie(0);
  44. cout.tie(0);
  45. ll n;
  46. cin >> n;
  47. vector<string> a(n);
  48. map<pair <string, string>, ll> b;
  49. set<string> arr;
  50. for(int i = 0; i < n; i++){
  51. cin >> a[i];
  52. }
  53. for(int i = 0; i < n; i++){
  54. for(int j = 0; j < a[i].size() - 3; j++){
  55. string s1, s2;
  56. s1 = a[i].substr(j, 3);
  57. //cout << "#" << s1 << endl;
  58. s2 = a[i].substr(j + 1, 3);
  59. //cout << "*" << s2 << endl;
  60.  
  61. b[{s1, s2}]++;
  62. arr.insert(s1);
  63. arr.insert(s2);
  64.  
  65.  
  66. }
  67. }
  68. ll ans1, ans2;
  69. ans1 = 0;
  70. ans2 = 0;
  71. ans1 = b.size();
  72. for(auto it : b){
  73. if(it.f.f != it.f.s){
  74. ans2 += 2;
  75. }
  76. else{
  77. ans2++;
  78. }
  79. //cout << it.f.f << ' ' << it.f.s << ' ' << it.s << endl;
  80. }
  81. cout << arr.size()<< endl;
  82. cout << ans1 << endl;
  83. for(auto it : b){
  84. cout << it.f.f << ' ' << it.f.s << ' ' << it.s << endl;
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement