Adding Ex 1.5 solution.
Added Ex 1.8 to check for string rotation.