Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define MAXN 100000
- #define MAXW 21
- using namespace std;
- int N, K, i;
- int main() {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- cin>>N;
- cin>>K;
- string W[N];
- for(i=0; i<N; i++)
- cin>>W[i];
- int con=0;
- for(i=0; i<N; i++){
- if(con+sizeof(W[i])<K){
- cout<<W[i]<<" ";
- con=1+con+sizeof(W[i]);
- }else{
- cout<<endl<<W[i]<<" ";
- con=1+sizeof(W[i]);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment