// // read from file // write to file // // prints one word per line // import java.io.*; import java.util.StringTokenizer; public class Echo { public static void main( String[] args ) throws IOException { String delimiters = " .?!()[]{}|?/&\\,;:-\'\"\t\n\r"; BufferedReader inputFile = new BufferedReader( new FileReader( args[0] ) ); PrintWriter outputFile = new PrintWriter( new FileWriter( args[1] ) ); String line = null; while( true ) { line = inputFile.readLine(); if ( line == null ) break; line = line.toLowerCase(); StringTokenizer tokens = new StringTokenizer( line, delimiters ); while ( tokens.hasMoreElements() ) { String word = (String) tokens.nextElement(); outputFile.println( word ); } } inputFile.close(); outputFile.close(); } }