We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Simple Text Editor
- Discussions
Simple Text Editor
Simple Text Editor
Sort by
recency
|
246 Discussions
|
Please Login in order to post a comment
I am at a loss on this one. Many of the test cases are failing, yet my output when I run locally matches the expected output perfectly. I get 'wrong answer'. If anyone has a clue what it could be let me know. My code:
straightforward solution in python:
This doesn't look like an intermediate level problem. Seems much easier that 'Lego Blocks' for example.
include
include
include
include
include
include
using namespace std;
class S { private: string my_string{};
};
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int Q; cin >> Q;
}
PYTHON SOLUTION
APPEND = 1 DELETE = 2 PRINT = 3 UNDO = 4
class TextEditor: def init(self, initial_str: str = ""): self.current_str = list(initial_str) self.stack = []
self.print(int(parts[1])) elif op == UNDO: self.undo()
if name == "main": Q = int(input()) editor = TextEditor() for _ in range(Q): command = input().strip() editor.command(command)