Retina 0.8.2, (削除) 42 (削除ここまで) 34 bytes
r`(?<-1>.)+(?<=(\w\w)+),
,
D`\w
,$
Try it online! Link includes test cases. Explanation:
r`(?<-1>.)+(?<=(\w\w)+),
,
Delete 1 character for every pairThe r modifier causes the regex to be processed from right to left, so that the , is matched first, before the lookbehind then matches as many pairs of letters as possible. .NET captures each matching pair into a stack of values for capture group 1. The balancing group then matches once for each value in the stack, starting atthus deleting 1 character from the end of eachthe row and working backwardsfor every pair of letters.
D`\w
Remove all duplicate letters.
,$
Check that no letters of S remain.
Retina 0.8.2, (削除) 42 (削除ここまで) 34 bytes
r`(?<-1>.)+(?<=(\w\w)+),
,
D`\w
,$
Try it online! Link includes test cases. Explanation:
r`(?<-1>.)+(?<=(\w\w)+),
,
Delete 1 character for every pair of letters, starting at the end of each row and working backwards.
D`\w
Remove all duplicate letters.
,$
Check that no letters of S remain.
Retina 0.8.2, (削除) 42 (削除ここまで) 34 bytes
r`(?<-1>.)+(?<=(\w\w)+),
,
D`\w
,$
Try it online! Link includes test cases. Explanation:
r`(?<-1>.)+(?<=(\w\w)+),
,
The r modifier causes the regex to be processed from right to left, so that the , is matched first, before the lookbehind then matches as many pairs of letters as possible. .NET captures each matching pair into a stack of values for capture group 1. The balancing group then matches once for each value in the stack, thus deleting 1 character from the end of the row for every pair of letters.
D`\w
Remove all duplicate letters.
,$
Check that no letters of S remain.
Retina Retina 0.8.2, 42(削除) 42 (削除ここまで) 34 bytes
~(r`(?<-1>.)+(?<=(\w\w)+),
,
\w+$
]+$
^D`\w
,[$
Try it online! Try it online! Link includes test cases. Explanation:
r`(?<-1>.)+(?<=(\w\w)+),
,
Delete 1 character for every pair of letters, starting at the end of each row and working backwards.
\w+$
]+$
^
,[D`\w
Remove the string S and wrap the halved keyboard in ,[ and ]+$all duplicate letters.
~(`,$
Evaluate the result as a regex and applyCheck that to the original inputno letters of S remain.
Retina, 42 bytes
~(r`(?<-1>.)+(?<=(\w\w)+),
,
\w+$
]+$
^
,[
Try it online! Link includes test cases. Explanation:
r`(?<-1>.)+(?<=(\w\w)+),
,
Delete 1 character for every pair of letters, starting at the end of each row and working backwards.
\w+$
]+$
^
,[
Remove the string S and wrap the halved keyboard in ,[ and ]+$.
~(`
Evaluate the result as a regex and apply that to the original input.
Retina 0.8.2, (削除) 42 (削除ここまで) 34 bytes
r`(?<-1>.)+(?<=(\w\w)+),
,
D`\w
,$
Try it online! Link includes test cases. Explanation:
r`(?<-1>.)+(?<=(\w\w)+),
,
Delete 1 character for every pair of letters, starting at the end of each row and working backwards.
D`\w
Remove all duplicate letters.
,$
Check that no letters of S remain.
Retina, 42 bytes
~(r`(?<-1>.)+(?<=(\w\w)+),
,
\w+$
]+$
^
,[
Try it online! Link includes test cases. Explanation:
r`(?<-1>.)+(?<=(\w\w)+),
,
Delete 1 character for every pair of letters, starting at the end of each row and working backwards.
\w+$
]+$
^
,[
Remove the string S and wrap the halved keyboard in ,[ and ]+$.
~(`
Evaluate the result as a regex and apply that to the original input.