#include<bits/stdc++.h> using namespace std; int main(){ int n,m=0,k=0,l; size_t p; string a,b; while(getline(cin,a)){ if(a[0] == '+') m++; else if(a[0] == '-') m--; else { k+=m*(a.size()-a.find(':')-1); } } cout << k <<endl; return 0 ; }
Post a Comment
No comments:
Post a Comment