
1998 HIGH SCHOOL PROGRAMMING CONTEST
Problem 6 – Rotate-O-String 2000TM
Description:
As a programmer at Whiz-Bang Corporation, living on the bleeding edge of technological progress is part of your daily routine. The recent invention of the stringTM at Whiz-Bang’s Advanced Projects Labs has all the programmers here at a level of giddiness not seen since the development of the integerTM. Now Whiz-Bang has asked you to show off the power of this amazing new development.
One of the most interesting possibilities that strings bring us is the ability to manipulate the letters within them. Whiz-Bang wants you to use this capability to develop a system that rotates the entire contents of a user-input string. Your program then prints out an entire cycle of rotations, with each rotation moving every character in the string to the left one place. The first character of the string should be moved to the end of the string. The rotation ends when the last string rotated matches the original.
Your code must be able to handle any input string of less than eighty characters. Your program also must allow the user to continue using the program by asking the user if they want to enter another string. A user input of “yes” or “YES” (minus the quotes) should restart the program. Be sure to be kind to your users when they leave the program.
If you do a very good job on this project, Whiz-Bang may let you in on the development of their next revision of this astounding system… String 98TM !
Example:
(boldface indicates
user input)
Please enter your string:
Hello there
Hello there
ello thereH
llo thereHe
lo thereHel
o thereHell
thereHello
thereHello
hereHello t
ereHello th
reHello the
eHello ther
Hello there
Would you like to enter another string? no
Thank you for using Rotate-O-String 2000.