import sys if sys.platform =='ios': import clipboard a=clipboard.get() a = a.split('\n') text = '\n'.join(a) with open('input_file.txt','w') as f: f.write(text) sys.stdin = open('input_file.txt') s = input() n = len(s) ans = 10**8 for i in range(n): for j in range(i+1,n): for l in range(j+1,n): if s[i] == "c" and s[j] == "w" and s[l] == "w": ans = min(ans,l-i+1) if ans == 10**8: exit(print(-1)) print(ans)