util method to find the longestRecurringCycle in a string.