Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6. string s;
  7. cout << "Введите текст" << endl;
  8. getline(cin, s);
  9. s.insert(s.end(), ' ');
  10. int k = -1, i = 0, j = 0, sum = 0;
  11. do
  12. {
  13. k = s.find(" ", k + 1);
  14. if (k != -1)
  15. {
  16. j = k - i;
  17. if (j == 5) {
  18. sum += 1;
  19. for (i; i < k; i++)
  20. cout << s[i];
  21. cout << " ";
  22. }
  23. }
  24. = k + 1;
  25. } while (k != -1);
  26. if (sum == 0)
  27. cout << "таких нет" << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement