#include<stdio.h>
int is_right(char*a, int loc){
if((a[loc]>='a' && a[loc]<='z')|| (a[loc]>='A' && a[loc]<='Z')){
return 1;
}
else{
return -1;
}
}
int main(){
int sign = 1;
char charecter[10000]={0};
char*loc = charecter;
while(~scanf("%c", loc))loc++;
int lenth = (loc-charecter)/sizeof(char);
int i, j;
for(i=lenth-2; i>=0 ; i=j){
for(j=i; is_right(charecter, j)==sign; j--);
for(int x=j+1; x<=i; x++){
if(sign==1){
printf("%c", charecter[x]);
}
else{
printf(" ");
}
}
sign*=-1;
}
}