Problem Statement:- You are given a string S with length N that contains only the 26 lowercase English letters. You are also given a sequence W1,W2,…,W26 of weights corresponding to these letters in the order from 'a' to 'z', i.e. W1 is the weight of 'a', W2 is the weight of 'b' and so on.
We define the weight of a string as the sum of weights of all characters present in it. If a character occurs multiple times in this string, its weight is also counted multiple times.
Next, we define the power of a string s as the sum of weights of all strings r such that s can be represented as r+r+…+r+p, where + denotes string concatenation and p is a prefix of r (possibly empty).
Can anyone explain what does the author mean here by power of the string. Even after reading it 100 times I can't understand the statement. I would also like to know that am I just too dumb to understand it or you also think the problem statement is shit .
Link to problem statement .This problem is a part of live codechef long challenge.