Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. char s[256];
  9. int m, c;
  10. c = 0;
  11. cin >> m;
  12. cin >> s;
  13. while(1){
  14. if ( c + strlen(s) < m ){
  15. cout << s << ' ';
  16. c = c + 1 + strlen(s);
  17. }else{
  18. cout << endl << s;
  19. c = strlen(s);
  20. }
  21. cin >> s;
  22. if(s[0] == '\0')
  23. break;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement