Did you know that there are over 40,000 varieties of Rice in the world ? There are so many dishes that can be prepared with Rice too. A famous chef from Mumbai, Tid Gusto prepared a new dish and named it 'Tid Rice'. He posted the recipe in his newly designed blog for community voting, where a user can plus (+) or minus (-) the recipe. The final score is just the sum of all votes, where (+) and (-) are treated as +1 and -1 respectively. But, being just a chef ( and not a codechef ) he forgot to take care of multiple votes by the same user.

A user might have voted multiple times and Tid is worried that the final score shown is not the correct one. Luckily, he found the user logs, which had all the N votes in the order they arrived.  Remember that, if a user votes more than once, the user's previous vote is first nullified before the latest vote is counted ( see explanation for more clarity ). Given these records in order ( and being a codechef yourself :) ), calculate the correct final score.

-----Input-----
First line contains T ( number of testcases, around 20 ). T cases follow. Each test case starts with N ( total number of votes, 1 <= N <= 100 ). Each of the next N lines is of the form "userid vote" ( quotes for clarity only ), where userid is a non-empty string of lower-case alphabets ( 'a' - 'z' ) not more than 20 in length and vote is either a + or - . See the sample cases below, for more clarity.

-----Output-----
For each test case, output the correct final score in a new line

-----Example-----
Input:
3
4
tilak +
tilak +
tilak -
tilak +
3
ratna +
shashi -
ratna -
3
bhavani -
bhavani +
bhavani -

Output:
1
-2
-1

Explanation

Case 1 : Initially score = 0. Updation of scores in the order of user tilak's votes is as follows,

( + ): +1 is added to the final score. This is the 1st vote by this user, so no previous vote to nullify. score = 1
( + ):  0 should be added ( -1 to nullify previous (+) vote, +1 to count the current (+) vote ). score = 1
( - ) : -2 should be added ( -1 to nullify previous (+) vote, -1 to count the current (-) vote ). score = -1
( + ): +2 should be added ( +1 to nullify previous (-) vote, +1 to count the current (+) vote ). score = 1

Difficulty: interview

Starter code:

Solutions:
import sys

def f(p):
  votes = {}
  for x in range(p):
    str = sys.stdin.readline()
    t = str.split()
    votes[t[0]] = t[1]

  ans = 0
  for per in votes:
    if votes[per] == "+":
      ans= ans+1
    else:
      ans = ans-1

  return ans

x = sys.stdin.readline()
for t in range(int(x)):
  p = sys.stdin.readline()
  print(f(int(p)))


def rating():
 N = int(input())
 a = { }
 ans = 0
 while N:
  N-=1
  s = input()
  a[s[:-2]] = s[-1:]
 for k,v in a.items():
  if v == '+':
   ans += 1
  else:
   ans -= 1
 return ans

def main():
 T = int(input())
 while T:
  T -= 1
  rate = rating()
  print(rate)

def __starting_point():
 main()

__starting_point()

t = int(input())
for i in range(t):
 n = int(input())
 scores = {}
 for j in range(n):
  line = input()
  (key, value) = line.split(' ')
  if value == '+':
   scores[key] = 1
  else:
   scores[key] = -1
 sum = 0
 for k in scores:
  sum += scores[k]
 print(sum)


import sys
t=int(sys.stdin.readline().strip())
for i in range(t):
 votes={}
 n=int(sys.stdin.readline().strip())
 for j in range(n):
  s,v=sys.stdin.readline().strip().split(' ')
  if v=='+':
   votes[s]=1
  else:
   votes[s]=-1
 print(sum(votes.values()))