#MATL , 21 bytes
MATL , 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
###Explanation
Explanation
This processes each character in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current character is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each char from this string:
K % Push previous char, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current char
k % Convert to lower case.
= % True if current and previous chars are (case-insensitively) equal
K % Push previous char
@ % Push current char
XK % Update clipboard K with current char. This doesn't affect the stack
= % True if current and previous chars are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous char
&h % Concatenate horizontally to gradually build the output string
#MATL , 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
###Explanation
This processes each character in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current character is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each char from this string:
K % Push previous char, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current char
k % Convert to lower case.
= % True if current and previous chars are (case-insensitively) equal
K % Push previous char
@ % Push current char
XK % Update clipboard K with current char. This doesn't affect the stack
= % True if current and previous chars are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous char
&h % Concatenate horizontally to gradually build the output string
MATL , 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
Explanation
This processes each character in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current character is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each char from this string:
K % Push previous char, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current char
k % Convert to lower case.
= % True if current and previous chars are (case-insensitively) equal
K % Push previous char
@ % Push current char
XK % Update clipboard K with current char. This doesn't affect the stack
= % True if current and previous chars are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous char
&h % Concatenate horizontally to gradually build the output string
- 106.7k
- 10
- 139
- 382
#MATL, 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
###Explanation
This proccessesprocesses each charcharacter in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current charcharacter is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each char from this string:
K % Push previous char, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current char
k % Convert to lower case.
= % True if current and previous chars are (case-insensitively) equal
K % Push previous char
@ % Push current char
XK % Update clipboard K with current char. This doesn't affect the stack
= % True if current and previous chars are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous char
&h % Concatenate horizontally to gradually build the output string
#MATL, 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
###Explanation
This proccesses each char in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current char is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each char from this string:
K % Push previous char, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current char
k % Convert to lower case.
= % True if current and previous chars are (case-insensitively) equal
K % Push previous char
@ % Push current char
XK % Update clipboard K with current char. This doesn't affect the stack
= % True if current and previous chars are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous char
&h % Concatenate horizontally to gradually build the output string
#MATL, 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
###Explanation
This processes each character in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current character is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each char from this string:
K % Push previous char, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current char
k % Convert to lower case.
= % True if current and previous chars are (case-insensitively) equal
K % Push previous char
@ % Push current char
XK % Update clipboard K with current char. This doesn't affect the stack
= % True if current and previous chars are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous char
&h % Concatenate horizontally to gradually build the output string
#MATL, 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
###Explanation
This proccesses each char in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current char is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each characterchar from this string:
K % Push previous characterchar, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current characterchar
k % Convert to lower case.
= % True if bothcurrent charactersand previous chars are (case-insentivelyinsensitively) equal
K % Push previous characterchar
@ % Push current characterchar
XK % Update clipboard K with current characterchar. This doesn't affect the stack
= % True if bothcurrent charactersand previous chars are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous character from clipboardchar
&h % Concatenate horizontally to gradually build the output string
#MATL, 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
###Explanation
This proccesses each char in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current char is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each character:
K % Push previous character, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current character
k % Convert to lower case.
= % True if both characters are (case-insentively) equal
K % Push previous character
@ % Push current character
XK % Update clipboard K with current character. This doesn't affect the stack
= % True if both characters are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous character from clipboard
&h % Concatenate horizontally to gradually build the output string
#MATL, 21 bytes
"Kk@k=K@XK=>?4XKx}K&h
Try it online!. Or verify all test cases.
###Explanation
This proccesses each char in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current char is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
" % Take input string implicitly. For each char from this string:
K % Push previous char, initiallized to number 4
k % Convert to lower case. For numbers it rounds down
@ % Push current char
k % Convert to lower case.
= % True if current and previous chars are (case-insensitively) equal
K % Push previous char
@ % Push current char
XK % Update clipboard K with current char. This doesn't affect the stack
= % True if current and previous chars are (case-sensitively) equal
>? % If first comparison was true and second was false
4XKx % Reset clipboard K to 4
} % Else
K % Push previous char
&h % Concatenate horizontally to gradually build the output string