Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program for A Pattern Matching Problem (henceforth referred as PattMatch). Your program should take two inputs (both are string) - 1. Pattern 2.
Write a program for A Pattern Matching Problem (henceforth referred as PattMatch). Your program should take two inputs (both are string) - 1. Pattern 2. Name Your program should determine whether Name matches Pattern. It produces output "MATCHED" if Name Matches Pattern otherwise it produces "NOT MATCHED" Pattern consists of characters a-3, A-Z,* and ?. Among these and ? are wild card characters. The character * means or matches with zero or more characters. The character ? means or matches with exactly one character. Few examples of Pattern and their meaning is given in following table - Pattern Ad Meaning Any string beginning with Ad, or Ad followed by zero or more characters Any string of length 3 characters and ending with p Any string of length two or more characters ?? ??* Few examples of program input and output are as given below- Program Input Program Output Pattern Name Ad Ad* ??p ??p Adgy Aqui drp wsy MATCHED NOT MATCHED MATCHED NOT MATCHED Write a program for a pattern matching problem described in above. This is to be done in C++. But you can't use any library function related with regular expression and character matching
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started