Pattern Matching Program In Python