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