Answered step by step
Verified Expert Solution
Question
1 Approved Answer
THIS IS C, PLEASE ANSWER BEFORE NOON! 2. (35 pts) Filtering a string to remove escapes and find wildcards In some string comparisons algorithms, the
THIS IS C, PLEASE ANSWER BEFORE NOON!
2. (35 pts) Filtering a string to remove escapes and find wildcards In some string comparisons algorithms, the character is a wildcard and allows any character to match that position in the string. However, if the '.' should not be interpreted as a wildcard then it is proceeded by the escape character '\'. For example, "Clems.n" is used to find a string that matches all the letters except any character can appear in the position of the wildcard. But, the pattern "a\.b" means match the exact pattern "a.b" without allowing a wildcard substitution. The 'V' is considered an escape character, and is used to indicate that the next character is not a special symbol but instead is a plain character. So, "al\b" is treated as "a\b". For example, a "." pattern is not a wildcard because of the escape character. The pattern"\\." does have a wildcard because the first 'V' is an escape character but the second '\' is not. Write a program that prompts a user for an input string. Then, copy the input string to an output string called answer and remove the escape characters. Also, print the positions where the wildcards are found in the output string. Assume the input string is always less than 79 characters. For example, if the input is: Input> cl.ms\.n\\.\.tbal\1 Your code must print Wildcard in position 2 Wildcard in position 9 Final string is: cl.ms.n\F..tball Notice the escape characters have been removed and the ', 'S in positions 5 and 10 of the final string are not wildcards. int main(void) char text [80], answer [80]; int count = 0; printf ("Input> "); Egets (text, sizeof (text), stdin)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