object Main extends App {
    val in = io.Source.stdin.getLines
    for (s <- in if s != "#") {
        val ss = s.map("hijklmnopuy".contains(_))
        println(ss.zip(ss.tail).count(p => p._1 ^ p._2 == true))
    }
}