Prove commutativity on this monoid presentation.
+2
−0
Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ from $S$.
For example for $A=100$ and $B = 010$, one solution is $S = 10101010$ since
$$ (10101)010 \rightarrow 010 $$$$ 10(10101)0 \rightarrow 100 $$For a more complex example if $A = 1100$ and $B = 0101$, then one solution is $S = 11010101010101$ since
$$ 110(10101)010101 \rightarrow 1100(10101) \rightarrow 1100 $$$$ 1(10101)01010101 \rightarrow (10101)0101 \rightarrow 0101 $$There are multiple solutions to every possible input, but there is no requirement that the output be any particular one, only that it satisfy the requirements.
This is code-golf, the goal is to minimize the size of your source code as measured in bytes.
0 comment threads