#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
char s[105];
int num,ans;
int main()
{
num=0;ans=0;
while(gets(s))
{
if(s[0]=='+')
num++;
else if(s[0]=='-')
num--;
else
{
int pos=1;
while(s[pos]!=':')
pos++;
ans+=(strlen(s)-pos-1)*num;
}
//printf("ans=%d\n",ans);
}
printf("%d\n",ans);
}
cf 5a Chat Server's Outgoing Traffic
最新推荐文章于 2018-07-20 15:04:49 发布