#include <iostream>
#include <stack>
#include <string>
using namespace std;
class stack<string> st;
int check(){
string s;
s=st.top();
st.pop();
int t=0;
for(int i=0;i<s.length();i++){
if (((s[i]>='a')&&(s[i]<='z'))||((s[i]>='A')&&(s[i]<='Z'))) {
}else {
st.push(s.substr(t,i-t));
t=i+1;
}
}
if (t==0) {
st.push(s);
}else {
st.push(s.substr(t,s.length()-t));
}
return 0;
}
int main() {
string s;
char c;
while (cin >> s) {
st.push(s);
}
while (!st.empty()) {
check();
cout<<st.top()<<' ';
st.pop();
}
}