object Main extends App {
    val in = io.Source.stdin.getLines
    for (s <- in if s != "#") {
        val ss = s.map("hijklmnopuy".contains(_))
        println(ss.tail.foldLeft((0, ss.head)){
            case ((cnt, state), is_right) =>
                (if (is_right == state) cnt else cnt + 1, is_right)
        }._1)
    }
}