unittest
{
	assert( [ "<>>" ].parse.expand.solve == 3 );
	assert( [ "<>>><<><<<<<>>><" ].parse.expand.solve == 28 );
}



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 ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	auto ans = 0L;
	auto m = 0L;
	foreach( g; s.group )
	{
		auto c = cast( long ) g[ 1 ];
		if( g[ 0 ] == '<' )
		{
			ans += c * ( c - 1 ) / 2;
			m = c;
		}
		else
		{
			ans += max( m, c ) + c * ( c - 1 ) / 2;
			m = 0;
		}
	}
	ans += m;
	return ans;
}
