package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	var s string
	fmt.Scan(&s)
	b := []byte(s)
	var cCnt, wCnt int
	for _, k := range b {
		switch k {
		case 'c':
			cCnt++
		case 'w':
			wCnt++
		}
	}
	cCnt--
	fmt.Println(min(cCnt, wCnt))
	return
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}