Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <vector>
- #include <string>
- #include <algorithm>
- using namespace std;
- void main() {
- setlocale(LC_ALL, "RU");
- string str = "мерс сука ебаная"; //м р к б н
- string sogl = "бвгджзйклмнпрстфхцчшщъь";
- vector<char> myVector;
- cout << str << "\t" << str.size() << endl;
- for (size_t i = 0; i < str.size(); ++i) //по строке
- {
- bool check = false;
- for (size_t j = 0; j < sogl.size() && !check; ++j) //по согласным
- {
- if (str[i] == sogl[j]) //согласно ли оно
- {
- for (size_t k = i + 1; k < str.size(); ++k)
- {
- if (sogl[j] == str[k])
- {
- check = true;
- break;
- }
- }
- if (!check)
- myVector.push_back(str[i]);
- str.erase(std::remove(str.begin(), str.end(), sogl[j]), str.end());
- --i;
- check = true;
- }
- }
- }
- for (size_t j = 0; j < sogl.size(); ++j)
- {
- for (size_t i = 0; i < myVector.size(); ++i)
- {
- if (sogl[j] == myVector[i])
- {
- cout << myVector[i];
- break;
- }
- }
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement