import std.stdio, std.conv, std.string, std.range, std.math, std.bigint, std.algorithm, core.bitop; enum INF = 1 << 30; void main() { auto S = readln.strip; int ans = INF; foreach (i; 0 .. S.length - 1) { if (S[i] != 'c') continue; foreach (j; i + 1 .. S.length) { if (S[j] != 'w') continue; foreach (k; j + 1 .. S.length) { if (S[k] == 'w') ans = min(ans, k - i + 1); } } } (ans == INF ? -1 : ans).writeln; }