"use strict"

const arg_str = require('fs').readFileSync('/dev/stdin', 'UTF-8')
const s = arg_str

const s_array = s.split('')
let cnt = 1

s_array.forEach(function(item, index) {
  if(index > 0){
    const past_value = s_array[index - 1]
    const current_value = s_array[index]
    if(past_value != current_value){
      cnt++
    }
  }
}, cnt)

console.log(cnt)