data = "pwwkew"
answer = 1
max_idx = 0
for i in range(len(data)-1):
    if data[i] != data[i-1] and data[i] != data[i+1]:
        answer += 1
    else:
        if answer > max_idx:
            max_idx = answer
            answer = 1

print(max_idx)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: