← 返回 bytedance 的题目列表Changing Username Fibonacci Transformation
类型:online_judge
bytedance
Given a string username consisting of several contiguous segments of lowercase letters. Each contiguous letter segment can be transformed into a number according to a Fibonacci sequence. Specifically, the first letter segment corresponds to the first term of the Fibonacci sequence, the second to the second term, third to the third term, and so on. Your task is to: compute the number of contiguous letter segments in username, sort the counts in ascending order, transform each segment count using the Fibonacci sequence, multiply all the numbers together, and return the result mod 10^9+7.
Input Format:
A string username consisting of lowercase letters only, with a length not exceeding 1000.
Output Format:
An integer representing the product of transformed numbers, mod 10^9+7.
Example:
Input: aaabbcc
Output: 1
Explanation: The segments are: aaa, bb, cc. Their counts are 3, 2, 2. After sorting: 2, 2, 3. Correspond to Fibonacci sequence F(2), F(2), F(3), which are 1, 1, 2. Product is 112 = 2, and the result is mod 10^9+7.
Example
Input
aaabbcc