package ITUannotation;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Formatter;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Tokenizer {
	Scanner in;
	Formatter out;
	public Tokenizer(String inputfilename,String outputfilename) throws FileNotFoundException {
		in=new Scanner(new File(inputfilename));
		out=new Formatter(outputfilename);
	}

	/**
	 * @param args
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws FileNotFoundException {
		Tokenizer t=new Tokenizer("input3.txt","input2.txt");
		t.tokenize();	
	}

	public void tokenize() {
		String line=in.nextLine();
		in.close();
		String symbols=",._'-\"?!:;)(][";
		StringTokenizer st = new StringTokenizer(line);
	     while (st.hasMoreTokens()) {
	    	 String s=st.nextToken();
	    	 char beginsymbol='\0';
	    	 char endsymbol='\0';
	    	 if(s.length()!=1&&symbols.contains(Character.toString(s.charAt(0)))){
	    		 beginsymbol=s.charAt(0);
	    		 s=s.substring(1, s.length());	    		 
	    	 }
	    	 if(s.length()!=1&&symbols.contains(Character.toString(s.charAt(s.length()-1)))){
	    		 endsymbol=s.charAt(s.length()-1);
	    		 s=s.substring(0, s.length()-1);	    		 
	    	 }	    	 
	    	 if(beginsymbol!='\0'){
	    		 out.format("%c\n",beginsymbol);
	    		 System.out.println(beginsymbol);
	    	 }
	    	 out.format("%s\n", s);
	    	 System.out.println(s);
	    	 if(endsymbol!='\0'){
	    		 out.format("%c\n",endsymbol);
	    		 System.out.println(endsymbol);
	    	 }
	         
	     }
		out.close();
	}

}
