Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- char *p,s[256],cuv[55][20],aux[256];
- cin.get(s,256);
- int nr=0,i,j;
- for(i=0;s[i];++i)
- if((s[i]==' '&&s[i-1]!=' ')||(s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
- aux[nr++]=s[i];
- aux[nr]=NULL;
- strcpy(s,aux);
- p=strtok(s," ");
- nr=0;
- while(p)
- {
- strcpy(cuv[++nr],p);
- p=strtok(NULL," ");
- }
- for(i=1;i<=nr/2;++i)
- cout<<cuv[i]<<'\n'<<cuv[nr-i+1]<<'\n';
- if(nr%2)cout<<cuv[nr/2+1];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement