Your code is incomplete, but:
def cal(A,s):
x=s.count('x');
y=s.count('y');
if(x>y):
return max(A[0::x]);
else:
return max(A[0::y]);
Here, you are counting all 'x' and all 'y' in the string, which is wrong.
Your requirement is:
Quote:
You can select a substring with all equal characters and delete them and you will get the score i.e A[len] if len is the length of the substring deteted
Example:
xyxyxxyyxxyyyyxyxyxyx
^^^^ this is the substring of maximum length with all equal chars
You have to search where is that substring.