mashlukashova

Untitled

May 15th, 2019
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <string>
  2. #include <vector>
  3. #include <iostream>
  4. #include <cstdlib>
  5. using namespace std;
  6.  
  7.  
  8.  
  9. int main() {
  10. int l= 0;
  11. int p = 0;
  12. int v = 0;
  13. string str;
  14. vector<char>str_dop;
  15. string str_glas;
  16. // cout << "vvedite glas: " << endl;
  17. //getline(cin, str_glas);
  18.  
  19. cout << "vvedite str: " << endl;
  20. getline(cin, str);
  21. int n;
  22. n = str.length();
  23.  
  24. for (int i = 0; i < n; i++){
  25. // cout << p << endl;
  26. for (int j = p; j < n; j++){
  27. if (str[i] == str[j])l++;
  28. if (l == 5){
  29. str_dop.push_back(str[i]);
  30. v++;
  31. l = 0;
  32. }
  33. }
  34. l = 0;
  35. p++;
  36. }
  37.  
  38. for(int i = 0; i < v; i++){
  39. cout << str_dop[i] << " ";
  40. }
  41. cout << endl;
  42. int g = 0;
  43. cout << "vvedite glasnie: " << endl;
  44. getline(cin, str_glas);
  45. int m;
  46. m = str_glas.length();
  47. vector<char>str_iz_glas;
  48. for (int i = 0; i < v; i++){
  49. for(int j = 0; j < m; j++){
  50. if (str_dop[i] == str_glas[j]){
  51. str_iz_glas.push_back(str_dop[i]);
  52. g++;
  53. }
  54. }
  55. }
  56.  
  57. for(int i = 0; i < g; i++){
  58. cout << str_iz_glas[i] << " ";
  59. }
  60. cout << endl;
  61.  
  62. sort (str_iz_glas.begin(), str_iz_glas.end());
  63. cout << "v alf \n";
  64. for (auto x : str_iz_glas)cout << x << " ";
  65.  
  66. cout << endl;
  67. return 0;
  68. }
RAW Paste Data