unittest
{
	assert( [ "10", "ZABCDBABCQ" ].parse.expand.solve == 2 );
	assert( [ "19", "THREEONEFOURONEFIVE" ].parse.expand.solve == 0 );
	assert( [ "33", "ABCCABCBABCCABACBCBBABCBCBCBCABCB" ].parse.expand.solve == 5 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( dchar[] );
	return tuple( as );
}

auto solve( dchar[] as )
{
	auto ans = 0L;
	while( true )
	{
		as = as.find( "ABC" );
		if( as.empty ) break;
		as.popFrontN( 3 );
		ans++;
	}
	return ans;
}
