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
Simple Text Editor
Sort by
recency
|
544 Discussions
|
Please Login in order to post a comment
typescript boilerplate: 'use strict';
process.stdin.resume(); process.stdin.setEncoding('utf-8'); let inputString: string = ''; let inputLines: string[] = []; let currentLine: number = 0; process.stdin.on('data', function(inputStdin: string): void { inputString += inputStdin; });
process.stdin.on('end', function(): void { inputLines = inputString.split('\n'); inputString = ''; main(); });
function readLine(): string { return inputLines[currentLine++]; }
class TextEditor { private currentText:string; // Enter your code here constructor(){ this.currentText ="" } append(w:string){ // Enter your code here } delete(k:number){ // Enter your code here } print(k:number){ // Enter your code here } undo(){ // Enter your code here } }
type EditorMethod = "append" | "delete" | "print" | "undo";
function main() { const commandMap = {"1": "append", "2": "delete", "3" : "print", "4": "undo" } as const;
}
include
int main(){ //rudransh op in the chat //mohammad kaif topi in the chat return 0; }
Isn't the expected output of the sample test case wrong?
Input (stdin): 1 abc, 3 3, 2 3, 1 xy, 3 2, 3 1
The data contents should be: 1 abc => abc 3 3 => print c 2 3 => deleted abc 1 xy => xy 3 2 => print y 3 1 => print x (not a)