Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <vector>
  4. #include <string>
  5. #include <algorithm>
  6. using namespace std;
  7.  
  8. void main() {
  9. setlocale(LC_ALL, "RU");
  10. string str = "мерс сука ебаная"; //м р к б н
  11. string sogl = "бвгджзйклмнпрстфхцчшщъь";
  12. vector<char> myVector;
  13.  
  14. cout << str << "\t" << str.size() << endl;
  15.  
  16. for (size_t i = 0; i < str.size(); ++i) //по строке
  17. {
  18. bool check = false;
  19. for (size_t j = 0; j < sogl.size() && !check; ++j) //по согласным
  20. {
  21. if (str[i] == sogl[j]) //согласно ли оно
  22. {
  23. for (size_t k = i + 1; k < str.size(); ++k)
  24. {
  25. if (sogl[j] == str[k])
  26. {
  27. check = true;
  28. break;
  29. }
  30. }
  31. if (!check)
  32. myVector.push_back(str[i]);
  33. str.erase(std::remove(str.begin(), str.end(), sogl[j]), str.end());
  34. --i;
  35. check = true;
  36. }
  37. }
  38. }
  39. for (size_t j = 0; j < sogl.size(); ++j)
  40. {
  41. for (size_t i = 0; i < myVector.size(); ++i)
  42. {
  43. if (sogl[j] == myVector[i])
  44. {
  45. cout << myVector[i];
  46. break;
  47. }
  48. }
  49. }
  50. cout << endl;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement