<?php

$S = trim(fgets(STDIN));

$hogehoge = str_split($S);

$count = 1;

$aaa = count($hogehoge);
if(count(array_values(array_unique($hogehoge))) === 1) {
	while(1) {
		// $aaa -= 2;
	}

	// return ;
}

$tmp = $S[0];

$hoge = [];
for($i = 1;$i < strlen($S);$i++) {
	if($S[$i] === $tmp) {
		continue;
	} else {
		$hoge = [];
		$tmp = $S[$i];
		$count++;
	}
}

echo ($count + 1)."\n";