use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let mut s: Vec<char> = read::<String>().chars().collect();

    if s.len() == 1 {
        println!("1");
    } else {
        let mut tmp = s.pop().unwrap();
        let mut ans = 1;

        while let Some(c) = s.pop() {
            if c != tmp {
                ans += 1;
            }
            tmp = c;
        }

        println!("{}", ans + 1);
    }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}
