# 12109 - Text Editor 2 >author: Utin ###### tags: `string` --- ## Brief See the code below ## Solution 0 ```c= #include <stdio.h> #include <string.h> #define MAX_SIZE 1005 char input[MAX_SIZE]; char command[MAX_SIZE]; int main() { gets(input); gets(command); char* cursor = input; int op_len = strlen(command); for (int i = 1; i < op_len; i += 2) { if (command[i] == 'b') { if (cursor != input) { char temp[MAX_SIZE]; strcpy(temp, cursor); cursor--; strcpy(cursor, temp); *(cursor + strlen(temp)) = '\0'; } } else if (*cursor != '\0') cursor++; } printf("%s\n", input); } // By Utin ``` ## Reference
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up