You need to simulate a simple text editor that supports three operations:
Your task is to implement a function that processes a sequence of these operations and returns the final state of the text.
Example:
Input operations: ['append hello', 'append world', 'delete 5', 'undo']
append hello
: text is "hello"append world
: text is "helloworld"delete 5
: text is "hello"undo
: the delete is undone so the text goes back to "helloworld"Return the final text after processing all operations.
Hint: Consider using a stack to store the previous states or operations to efficiently implement the undo functionality.
Good luck!