import std; void main () { string S = readln.chomp; const int N = S.length.to!int; bool good (string X) { return (X[0] == X[1] && X[0] != X[2]) || (X[1] == X[2] && X[0] != X[1]); } int ans = 0; foreach (i; 0 .. N - 2) { if (good(S[i .. i + 3])) { ans++; } } writeln(ans); } void read (T...) (string S, ref T args) { import std.conv : to; import std.array : split; auto buf = S.split; foreach (i, ref arg; args) { arg = buf[i].to!(typeof(arg)); } }