// word scanner
import java.io.*;
import java.util.*;

public class TestScanner2 {
    public static void main(String[] args) throws IOException {
        Scanner s = 
            new Scanner(new BufferedReader(new FileReader("farrago.txt")));
	// Stop on one or more letter-chars
	// Add ' and - to the letter-chars:, but - has a special meaning 
	// inside [], so we need to escape it with \, and to use one \ 
	// we need to put another one in the String
	s.useDelimiter("[^A-Za-z\\-']+");

        while (s.hasNext()) {
	    String x = s.next();
	    String match = s.match().group();
            System.out.println(x + " ("+ x.length() + ") "+match );
        }
        s.close();
    }
}

