Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- ifstream in("lungimerandmax.in");
- ofstream out("lungimerandmax.out");
- int n,cnt;
- char s[10001],*p;
- int main()
- {
- in>>n;
- in.get();
- in.get(s,10001);
- in.get();
- p=strtok(s," ");
- while(p)
- {
- cnt+=strlen(p)+1;
- if(cnt<=n)
- out<<p<<" ";
- else
- cnt=strlen(p),out<<'\n',out<<p<<" ";
- p=strtok(NULL," ");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement