Part 8

String Reversal

One of the useful manipulations of strings is string reversal. Reversed string is simply a string in which the order of the element sequence is reversed, i.e. the first element becomes the last one, the second becomes second last, etc.

Example:
α = <1, 2, 3, 4, 5> and Reverse(α) = <5, 4, 3, 2, 1>;
β = <x, y, z> and Reverse(β) = <z, y, x>;

Reversing a string does not change the length of that string:

| β | = |Reverse(β)|;