Question: 3.24 Backspace Comparison You are to compare two strings as if they were typed into a text editor, and see if they are equal. The

3.24 Backspace Comparison You are to compare two strings as if they were typed into a text editor, and see if they are equal. The strings will only include uppercase letters, lowercase letters, and the char '%'. The char '%' represents backspace in this fictitious text editor. Whenever you encounter a '%' in the string, delete the previous non-% character if one exists. There are a few ways to solve this, but please use a stack based method. Print "Strings are equal" if your function returns true, and "Strings are not equal" if the function returns false. Do not use the following libraries: algorithm, cmath Examples Input of "App%%le" and 'Ap%p%le" will return true because after performing the backspace operation the strings will be "Ale" and "Ale" Input of "r%u%n%n%ing%" and "run%%%ning%%" will return false because after performing the backspace operation the strings will be "in" and "ni" Input Two strings consisting over uppercase letters, lowercase letters, and the char % Output Print "Strings are equal" if your function returns true, and "Strings are not equal" if the function returns false. LAB ACTIVITY 3.24.1: Backspace Comparison 014 Downloadable files main.cpp Download main.cpp Load default template... 1 // Include the necessary header files 3 bool backspaceCompare(std::string first, std::string second) { // Use a stack to imitate a text editor input characters int main() { // Read input into two strings // Call your function // Print the appropriate response return 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
