GeoCitesSites.com

Problem # 5 : Rotating Words

Write a sub-routine ROTATE(A$) to find the alphabetically highest and lowest rotated forms of a word given in the string A$ and print them on the screen.

A word is rotated by moving the first letter to the end of the word. The rotated forms of the word 'crow' are thus - crow rowc owcr wcro. Further rotation will result in the original word.

Sample Output
ROTATE("alphabets") should give the following output :
    Minimum rotated form : abetsalph
    Maximum rotated form : tsalphabe

ROTATE("crow") should give the following output :
    Minimum rotated form : crow
    Maximum rotated form : wcro


Previous Problem
Return to problems at The Vault
(Back to problems at The Vault )
Next Problem