Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <vector>
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main() {
- int l= 0;
- int p = 0;
- int v = 0;
- string str;
- vector<char>str_dop;
- string str_glas;
- // cout << "vvedite glas: " << endl;
- //getline(cin, str_glas);
- cout << "vvedite str: " << endl;
- getline(cin, str);
- int n;
- n = str.length();
- for (int i = 0; i < n; i++){
- // cout << p << endl;
- for (int j = p; j < n; j++){
- if (str[i] == str[j])l++;
- if (l == 5){
- str_dop.push_back(str[i]);
- v++;
- l = 0;
- }
- }
- l = 0;
- p++;
- }
- for(int i = 0; i < v; i++){
- cout << str_dop[i] << " ";
- }
- cout << endl;
- int g = 0;
- cout << "vvedite glasnie: " << endl;
- getline(cin, str_glas);
- int m;
- m = str_glas.length();
- vector<char>str_iz_glas;
- for (int i = 0; i < v; i++){
- for(int j = 0; j < m; j++){
- if (str_dop[i] == str_glas[j]){
- str_iz_glas.push_back(str_dop[i]);
- g++;
- }
- }
- }
- for(int i = 0; i < g; i++){
- cout << str_iz_glas[i] << " ";
- }
- cout << endl;
- sort (str_iz_glas.begin(), str_iz_glas.end());
- cout << "v alf \n";
- for (auto x : str_iz_glas)cout << x << " ";
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement