-
Word Split :
-
Arithm Geo
-
String Reduction :
Have the function StringReduction(str) take the str parameter being passed and return the smallest number you can get through the following reduction method.
The method is: Only the letters a, b, and c will be given in str and you must take two different adjacent characters and replace it with the third.
For example "ac" can be replaced with "b" but "aa" cannot be replaced with anything.
This method is done repeatedly until the string cannot be further reduced, and the length of the resulting string is to be outputted.
For example: if str is "cab", then "ca" can be reduced to "b" and you get "bb" (you can also reduce it to "cc").
The reduction is done so the output should be 2. If str is "bcab", "bc" reduces to "a", so you have "aab", then "ab" reduces to "c", and the final string "ac" is reduced to "b" so the output should be 1.
- Wild Card Characters :
Have the function WildcardCharacters(str) read str which will contain two strings separated by a space.
The first string will consist of the following sets of characters: +, *, and {N} which is optional.
The plus (+) character represents a single alphabetic character, the asterisk (*) represents a sequence of the same character of length 3 unless it is followed by {N} which represents how many characters should appear in the sequence where N will be at least 1.
Your goal is to determine if the second string exactly matches the pattern of the first string in the input.
For example: if str is "++*{5} gheeeee" then the second string in this case does match the pattern, so your program should return the string true.
If the second string does not match the pattern your program should return the string false.