### subroutines

def match?(c0, c1)
  (c0 == 'i' && c1 == 'i') ||
  (c0 == 'w' && c1 == 'w') ||
  (c0 == '(' && c1 == ')') ||
  (c0 == ')' && c1 == '(')
end

### main

str = gets.strip
n = str.length
k = (n - 1) / 2

count = 0

for i in (0..k)
  count += 1 if ! match?(str[i], str[n - 1 - i])
end

puts count