'use strict'
function main(input) {
  input = input.trim()
  const replaced = input.replace(/(0+1+|1+0+)/g, '')
  console.log(input.length - replaced.length)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
