TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

A scientist wants to analyse the emotions of chatters by extracting text-based emoticons within a chat log, which is a text string. He considers four emoticons and assigns them different values for each level of happiness:



:( a colon followed by an open parenthesis means sad. It is assigned the value -1.

:(( a colon followed by two open parentheses means very sad. It is assigned the value -5.

:) a colon followed by a close parenthesis means happy. It is assigned the value 2.

:)) a colon followed by two close parentheses means very happy. It is assigned the value 4.


In order to calculate the level of happiness for a chat, the scientist would like to extract all emotional symbols and the happiness level of a chat is the sum of the value of the emotional symbols in the chat. Your task is to write a program to help him to do so.

Input Format

The input file consists of several data sets. The first line of the input file contains the number of data sets which is a positive integer and is not bigger than 20. The following lines describe the data sets.

Each data set consists of only one line, which contains the text string representing the chat log.

Output Format

For each data set, write in one line the level of happiness of the chat log.

Sample Input 1

3
I am happy :), very happy :)).
I am happy :(, no actually sad :((
I win :), but I lost some friends :(:(, kidding :))

Sample Output 1

6
-6
4

Hints

Problem Source

Migrated from old NTUJ.

The ACM-ICPC 2010 Asia Regional Contest, Site Hanoi

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 200