Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <string>
- #include<iostream>
- #include <cctype> // для функции isdigit
- using namespace std;
- int main()
- {
- int last =0;
- string str;
- string s1;
- bool flag=false;
- getline(cin,str);
- for(int i=0; i<=str.length()-1;i++)
- {
- if((isdigit(str[i])==isdigit(str[i+1]))&&((str[i+1]!=' ')||(str[i]!=' ')))
- {
- flag = true;
- cout << "nu ebana";
- }
- if(str[i]==' ' && flag==false)
- {
- cout << last << ' ' << last-i << endl;
- s1 = s1+str.substr(last,last-i);
- last = i+1;
- }
- if(str[i]==' ' && flag == true)
- {
- flag = false;
- }
- }
- cout << s1;
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement