Extracted `inverser_chaine` into a reusable utility function with docstring and added unit test to ensure correctness.