Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <fstream>
  2. #include <string>
  3. #include<iostream>
  4. #include <cctype>   // для функции isdigit
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main()
  10. {
  11. int last =0;
  12. string str;
  13. string s1;
  14. bool flag=false;
  15. getline(cin,str);
  16.  
  17. for(int i=0; i<=str.length()-1;i++)
  18. {
  19. if((isdigit(str[i])==isdigit(str[i+1]))&&((str[i+1]!=' ')||(str[i]!=' ')))
  20. {
  21. flag = true;
  22. cout << "nu ebana";
  23. }
  24. if(str[i]==' ' && flag==false)
  25. {
  26. cout << last << ' ' << last-i << endl;
  27. s1 = s1+str.substr(last,last-i);
  28. last = i+1;
  29. }
  30. if(str[i]==' ' && flag == true)
  31. {
  32. flag = false;
  33. }
  34. }
  35. cout << s1;
  36. return 0;
  37. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement