🤖 AI Summary
This study addresses the problem of efficiently computing a reversible bilateral run-length decomposition of strings. The authors propose Flashback, a method that iteratively strips maximal contiguous character blocks from both ends of the string and pairs them into bilateral tokens, achieving linear time and space complexity for both decomposition and reconstruction. Leveraging a run-pairing theorem, they prove that this process is equivalent to sequentially pairing leading and trailing runs, derive an exact formula for the number of tokens, and show it attains the theoretical lower bound. Key contributions include characterizing the irreducible core as containing at most two distinct characters, revealing the symmetric run structure of palindromes, proving that modifying a single run affects only one content token, and establishing structural properties via finite-state automata and run-length encoding analysis.
📝 Abstract
We introduce Flashback, a reversible string decomposition that repeatedly peels the maximal leading and trailing character runs from a sentinel-wrapped input, recording each pair as one bilateral token. Decomposition and reconstruction both run in O(n) time and space. Our central result is a run-pairing theorem: Flashback is equivalent to pairing the first run of the string with the last, the second with the second-to-last, and so on. This gives an exact token count of 1+[r/2] for a string with r maximal runs, and matches a lower bound that holds for any admissible bilateral run-peeling scheme. From the run-pairing theorem the main structural properties follow as corollaries: the irreducible peeling kernel uses at most two symbols; palindromes are precisely the strings whose run-length encoding is symmetric with an odd number of runs; the image of the decomposition admits an explicit finite-state characterisation; and changing one run length rewrites exactly one content token.