public static String[] match(String s0, String s1) {
        // invariant: No match occurs with beginning char in s0[0..h-1]
        for (int h= 0; h <= s0.length() - MIN_MATCH; h= h+1) {
            String match= s0.substring(h, h+MIN_MATCH);
            int k= s1.indexOf(match);
            if (k >= 0) {
                // s0[h..h+MIN_MATCH-1] matches s1[k..k+MIN_MATCH-1].
                // Set n to the length of the longest match
                int n= MIN_MATCH;
                while (h+n < s0.length()  &&  k+n < s1.length() &&
                        s0.charAt(h+n) == s1.charAt(k+n)) {
                    n= n+1;
                }
                
                return new String[] {s0.substring(h, h+n),
                        s0.substring(0,h), s0.substring(h+n),
                        s1.substring(0,k), s1.substring(k+n)};
            }
        }

        return null;
    }