Haskell Quiz/Count and Say
Jump to navigation Jump to search
Ruby Quiz #138: This quiz involved counting the number of letters in a particular string, and generating a new string that would be the result of saying the results of the count. For instance, if we start with "HASKELL RULES", we get the sequence:
HASKELL RULES ONE A TWO E ONE H ONE K THREE L ONE R TWO S ONE U ONE A EIGHT E TWO H ONE K ONE L FIVE N SEVEN O TWO R ONE S THREE T ONE U TWO W
and so on. The object of the quiz is to determine, given an initial string, whether the sequence ever goes into a loop, and if so, how long the cycle length is.