object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val _, x :: xs = sc.next().toList
  val (_, compressed) = xs.foldLeft((x, List(x))) {
    case ((before, acc), char) =>
      if (before == char) before -> acc else char -> (char :: acc)
  }
  println(compressed.length)
}
