3134 - Entry for COJ 3134 - Entry for COJ 3134 - Entry for COJ

Statistics Sub: 64 | AC: 30 | AC%: 46,88 | Score: 3,28
Created by Nelson González Peñate
Added by npenate (2015-02-26)
Limits
Total Time: 7000 MS | Test Time: 1000 MS |Memory: 64 MB | Output: 64 MB | Size: 14 KB
Enabled languages
Available in

Description

The COJ Development Team (CDT) wants to announce a contest in the index page (that we know as entry). For capturing the attention of most of the users, they want the most attractive message possible using emoticons. For computing the value of a message they are based in the sum of the attraction values assigned to each emoticon in the message. Given the attraction values of each emoticon and the message compute the maximum value of such message. The table below shows the emoticons that can be contained in an entry.

The COJ Development Team (CDT) wants to announce a contest in the index page (that we know as entry). For capturing the attention of most of the users, they want the most attractive message possible using emoticons. For computing the value of a message they are based in the sum of the attraction values assigned to each emoticon in the message. Given the attraction values of each emoticon and the message compute the maximum value of such message. The table below shows the emoticons that can be contained in an entry.

The COJ Development Team (CDT) wants to announce a contest in the index page (that we know as entry). For capturing the attention of most of the users, they want the most attractive message possible using emoticons. For computing the value of a message they are based in the sum of the attraction values assigned to each emoticon in the message. Given the attraction values of each emoticon and the message compute the maximum value of such message. The table below shows the emoticons that can be contained in an entry.

Input specification

The first line of input contains an integer N (1 <= N <= 9) denoting the amount of types of emoticons that can be contained in the message. The next N lines contain a string S and an integer number V (1 <= V <= 10) separated by a single space, denoting the emoticon characters and the attraction value respectively. It is guaranteed that S is one of the nine icons in the table showed above. The last line of input shows the message that they want to announce. The length of the message will be less than 256 characters.
The first line of input contains an integer N (1 <= N <= 9) denoting the amount of types of emoticons that can be contained in the message. The next N lines contain a string S and an integer number V (1 <= V <= 10) separated by a single space, denoting the emoticon characters and the attraction value respectively. It is guaranteed that S is one of the nine icons in the table showed above. The last line of input shows the message that they want to announce. The length of the message will be less than 256 characters.
The first line of input contains an integer N (1 <= N <= 9) denoting the amount of types of emoticons that can be contained in the message. The next N lines contain a string S and an integer number V (1 <= V <= 10) separated by a single space, denoting the emoticon characters and the attraction value respectively. It is guaranteed that S is one of the nine icons in the table showed above. The last line of input shows the message that they want to announce. The length of the message will be less than 256 characters.

Output specification

The only line of output is the maximum value of the message that the CDT wants announce.
The only line of output is the maximum value of the message that the CDT wants announce.
The first line of input contains an integer N (1 <= N <= 9) denoting the amount of types of emoticons that can be contained in the message. The next N lines contain a string S and an integer number V (1 <= V <= 10) separated by a single space, denoting the emoticon characters and the attraction value respectively. It is guaranteed that S is one of the nine icons in the table showed above. The last line of input shows the message that they want to announce. The length of the message will be less than 256 characters.

Sample input

2
|:| 2
:| 3
El equipo de desarrollo del COJ anuncia la competencia del siglo. Participa |:|:|.

Sample output

6

Hint(s)

In the string "|:|:|" can be formed emoticons of many forms, but the most attractively is forming emoticons with ":|" and ":|" ignoring the first character "|". This form report a value of six. For example another form is "|:|" and ":|", but report the value of five. Then the first is the best.
In the string "|:|:|" can be formed emoticons of many forms, but the most attractively is forming emoticons with ":|" and ":|" ignoring the first character "|". This form report a value of six. For example another form is "|:|" and ":|", but report the value of five. Then the first is the best.
In the string "|:|:|" can be formed emoticons of many forms, but the most attractively is forming emoticons with ":|" and ":|" ignoring the first character "|". This form report a value of six. For example another form is "|:|" and ":|", but report the value of five. Then the first is the best.

Recommendation

We have carefully selected several similar problems: 3378 | 3573 | 3599 | 3147 | 1103 | 2191