I have to write a code in cpp a codeword generator. A codewordfor this project is any permutation of characters from an alphabet,and for this one our alphabet will be all uppercase letters{A,B,C,D … Z}. Our generator will create only codewords that willmatch a given pattern. We can use the <regex> library inorder to look for patterns in strings. To check if the string smatches the pattern std::regex_match(s, re). You will implement aclass named CodewordGenerator with two public methods:
I will appreciate the help, thank you!
Implementation: You will implement a class named CodewordGenerator. You may design this class as you wish, but it MUST have the following two public methods: std::string generateShortestword (std::string pattern); takes a string pattern and returns the shortest string that matches the pattern exploring the space of possible alphabet permutations in Breadth First Search order. The input string pattern is guaranteed to represent a valid regular expression pattern. std::string generateLengthWord (std::string pattern, int length); takes a string pattern and an integer n and returns a string of length n that matches the pattern exploring the space of possible alphabet permutations in Depth First Search order. Here too, the input string pattern is guaranteed to represent a valid regular expression pattern. Show transcribed image text Implementation: You will implement a class named CodewordGenerator. You may design this class as you wish, but it MUST have the following two public methods: std::string generateShortestword (std::string pattern); takes a string pattern and returns the shortest string that matches the pattern exploring the space of possible alphabet permutations in Breadth First Search order. The input string pattern is guaranteed to represent a valid regular expression pattern. std::string generateLengthWord (std::string pattern, int length); takes a string pattern and an integer n and returns a string of length n that matches the pattern exploring the space of possible alphabet permutations in Depth First Search order. Here too, the input string pattern is guaranteed to represent a valid regular expression pattern.
Expert Answer
Answer to I have to write a code in cpp a codeword generator. A codeword for this project is any permutation of characters from an…