furkaneken / stack Goto Github PK
View Code? Open in Web Editor NEWStack Implementation and Notepad' working principles
License: The Unlicense
Stack Implementation and Notepad' working principles
License: The Unlicense
End Input: If the current character is “1”, it will be interpreted as “ESC” to end the editing process of the input string and display the output. Delete: If the current character is “2”, it will be interpreted as a backspace and will delete the element on the left of the current cursor position. Move Cursor Left: If the current character is “3”, it will be interpreted as a “Left Arrow Key” and will move the invisible cursor to the character on the left of its current position. If the cursor is already at the beginning of the string then nothing will change. Move Cursor Right: If the current character is “4”, it will be interpreted as a “Right Arrow Key” and will move the invisible cursor to the character on the right of its current position. If the cursor is already at the end of the string then nothing will change. Reverse Text: If the current character is “5”, it will be interpreted as a “reverse button”, where it will reverse (flip) the text on the left of the cursor. Example: “Sabanci5” will become “icnabaS”. Find and Delete: If the current character is “6x”, it will be interpreted as a “Find and Delete button”. It will search on the left side of the cursor for all occurrences of “x” and delete them. Here “x” can be any character. Example: “I_love_computer_sc6eience” will become “I_lov_computr_science”. For an example; Input: sit3h4_isa_an_33336a33354444444example!1 Our output string will be based on the manipulations from the numbers. Here is a walkthrough. First number we see is ‘3’, so before that we don’t need to do anything. When we see ‘3’ we will move our invisible cursor left by one to be in between the letters ‘i’ and ‘t’ our next input is ‘h’ so it will go in between ‘i’ and ‘t’ to have result of “siht”. When we keep going we see the number ‘4’, which means move cursor right by one. Now our cursor is after the ‘t’. Then we don’t see a number till the next ‘3’ so our resulting string is now “siht_isa_an_”. Then we move our cursor left four times because there are four ‘3’ numbers in the string. Now our cursor is between ‘a’ and ‘_’ in the “isa_” string. Our next number is ‘6’ and it is followed by an ‘a’. This means find all the ‘a’ characters on the left of our cursor. Since the ‘a’ in ‘an_’ is now on the right of our cursor it won’t be deleted, but the ‘a’ in “_isa” will be because it’s in the left of our cursor. Our resulting string will be “siht_is_an_”. Following this, we will keep moving our imaginary cursor left by the amount of ‘3’ numbers we see. After this our cursor will be between ‘t’ and ‘_’. Our next operation is ‘5’ which is the operation that reverses the letters on the left of our cursor. At this moment only “siht” is in the left of our cursor, so when we reverse it the result will be “this” and our resulting whole string will be “this_is_an_”. Our next number is a series of ‘4’. The number ‘4’ means move the cursor right so we will move the cursor right by the count of ‘4’s we see. This will bring us to the end of the string and our cursor will be at the end now. After this our next input is “example!” so our resulting string will be “this_is_an_example!”. Finally the number ‘1’ will mean the string processing will be ended and we will print our resulting string “this_is_an_example!”.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.