Codeforces Beta Round 5


A. Chat Server's Outgoing Traffic
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
+Mike
Mike:hello
+Kate
+Dmitry
-Dmitry
Kate:hi
-Kate
Output
9
Input
+Mike
-Mike
+Mike
Mike:Hi   I am here
-Mike
+Kate
-Kate
Output
14
----------------------------------------------------------------------------------------------------
B. Center Alignment
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
This  is
Codeforces
Beta
Round
5
Output
************
* This  is *
*          *
*Codeforces*
*   Beta   *
*  Round   *
*     5    *
************
Input
welcome to the
Codeforces
Beta
Round 5
and
good luck
Output
****************
*welcome to the*
*  Codeforces  *
*     Beta     *
*   Round 5    *
*              *
*      and     *
*  good luck   *
****************
----------------------------------------------------------------------------------------------------
C. Longest Regular Bracket Sequence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
)((())))(()())
Output
6 2
Input
))(
Output
0 1
----------------------------------------------------------------------------------------------------
D. Follow Traffic Rules
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
1 1
2 1 3
Output
2.500000000000
Input
5 70
200 170 40
Output
8.965874696353
----------------------------------------------------------------------------------------------------
E. Bindian Signalizing
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 4 5 3
Output
7
----------------------------------------------------------------------------------------------------
