#include<iostream>
#include<string>
using namespace std;
string str;
int main(){
cin>>str;//读入字符串
int leng=str.length();
int s=0;
for(int i=0;i<(leng+1)/2;i++){
if(str[i]=='i'&&str[leng-i-1]=='w') s++;
if(str[i]=='w'&&str[leng-i-1]=='i') s++;
if(str[i]==')'&&str[leng-i-1]==')') s++;
if(str[i]=='('&&str[leng-i-1]=='(') s++;
}
cout<<s<<endl;
return 0;
}