Question: 2. Write a function to detect whether a given string has the ABA pattern (case sensitive), where A and B are non-empty substrings. For example,

 2. Write a function to detect whether a given string has

2. Write a function to detect whether a given string has the ABA pattern (case sensitive), where A and B are non-empty substrings. For example, string Tony's sister helps Tony" has this pattern with A-"Tony and B-"'s sister helps". Your function should take a pointer to the string as input and prints out (1) the two substrings A and B if it has such pattern, or (2) the original string if it does not have such pattern. Also write a code that reads an input string (end with the RETURN or newline) and calls the function you have defined to detect whether the input has the ABA pattern. When there are multiple ways to match the pattern, report any one of the match will be sufficient

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!