Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- using namespace std;
- int main(){
- string str;
- cout << "vvedite text: " << endl;
- getline(cin, str);
- int n;
- n = str.length();
- int v = 1;
- for (int i = 0; i < n; i++){
- if (str[i] == ' ')v++;
- }
- int k = 0;
- int l = 0;
- int z = 0;
- for (int i = 0; i < n; i++){
- if (str[i] == ' ')k++;
- if (k == v -1){
- for (int j = i + 1; j < n; j++){
- l++;
- if (((int)str[j] >= 48) && ((int)str[j] <= 57)){
- z++;
- }
- }
- break;
- }
- }
- cout << "z= " << z << endl;
- char p;
- cout << "nazhmite lub klavishu: " << endl;
- cin >> p;
- if (p != '%'){
- int b = 0;
- int a = 0;
- int c = 0;
- for (int i = 0; i < n; i++){
- if (str[i] != ' ')b++;
- if ((str[i] == ' ') || (str[i] == '.')){
- for (int j = a; j < b; j++){
- if (((int)str[j] >= 48) && ((int)str[j] <= 57)){
- c++; }
- }
- if (c <= z){
- for (int j = a; j < b; j++){
- cout << str[j];
- }
- }
- if (c > z){
- cout << " " << "{";
- for (int j = a; j < b; j++){
- cout << str[j];
- }
- cout << "}" << " ";
- }
- c = 0;
- a = b;
- b++;
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement