Question #286287

Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where:



'.' Matches any single character.​​​​


'*' Matches zero or more of the preceding element.


The matching should cover the entire input string (not partial).

Expert's answer

public class Main {
    public static void main(String[] args) {
        int[] answer = {87, 101, 32, 100, 111, 32, 110, 111, 116, 32, 100, 111, 32, 115, 117, 99,
                104, 32, 116, 97, 115, 107, 115, 32, 102, 111, 114, 32, 102, 114, 101, 101, 46};
        for (int i = 0; i < answer.length; i++) {
            System.out.print((char) answer[i]);
        }

    }
}
LATEST TUTORIALS
APPROVED BY CLIENTS