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
|
247 Discussions
|
Please Login in order to post a comment
My python solution
if name == 'main': text = [] edition = [] for _ in range(int(input())): op = input().split() if op[0] == '1': text.extend(op[1]) edition.append(len(op[1])) elif op[0] == '2': edition.append([]) for _ in range(int(op[1])): edition[-1].append(text.pop()) elif op[0] == '3': print(text[int(op[1])-1]) elif op[0] == '4': undo = edition.pop() if isinstance(undo, int): for _ in range(undo): text.pop() else: text.extend(undo[::-1])
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;
}