Determine string transform via end-append moves | MathWorks