#include"iostream"
#include"stdio.h"
#include"algorithm"
#include"string"
using namespace std;
int main()
{
int zuo,fanzhuan,i,len,count=1;
string a;
while(cin>>a)
{
if(a[0]=='-')
break;
zuo=0;
fanzhuan=0;
len=a.size();
for(i=0;i
{
if(a[i]=='{')
zuo++;
else //a[i]=='}'
{
if(zuo>0)//之前有{
zuo--;//配对儿成功,消去一对儿
else
//zuo==0: 之前都消掉了,或第一个就是}
{
fanzhuan++;
//a[i]='{';
zuo++;
}
}
}
printf("%d. %d\n",count++,fanzhuan+zuo/2);
}
}