Solved by 66 users: ...
UserDateAttemptTimeCMSC
bush`11 feb 2013`Ruby504.1379
zhuojie`28 oct 2009`Python105.7186
kornakovBSU`14 jul 2009`C++2100.0687
DAV`03 jun 2009`C++2600.0787
DAV`02 jun 2009`C++2400.0791
DAV`02 jun 2009`C++2300.0793
DAV`02 jun 2009`C++1900.0798
abortmozga.ru`09 may 2009`C++2600.04104
abortmozga.ru`09 may 2009`C++2300.04105
abortmozga.ru`09 may 2009`C++1800.04107
abortmozga.ru`09 may 2009`C++1900.04107
DAV`03 jun 2009`C++2700.07109
abortmozga.ru`09 may 2009`C++1700.04111
mikelan`08 mar 2012`C500.10144
Philip_PV`28 jul 2009`C++300.07147
ethanhunt`31 may 2011`C++900.08151
ethanhunt`31 may 2011`C++1000.05152
ethanhunt`31 may 2011`C++800.05154
Philip_PV`28 jul 2009`C++200.07157
ethanhunt`31 may 2011`C++700.05158
FordPerfect`27 feb 2010`C++200.08165
fetetriste`30 apr 2009`C++100.30167
 C++ 50 Java 6 Kylix 4 C 3 Ruby 1 Python 1 FPC 1
` >  >  >  >  >  >  >  >  >  > `

## Brackets III

Time limit = 1 second

Memory limit = 64 Mb

You are given a string consisting of the brackets "<",">"; "(",")"; "{","}"; "[","]". The problem is to find the number of substrings that are the regular brackets sequence (RBS).

The definition of RBS: RBS + RBS = RBS, <RBS> = RBS, (RBS) = RBS, [RBS] = RBS, (RBS) = RBS.

Examples of RBS: (), ([]), <>()[](<>){{}}, <{{{}}()}>.

Input A string consisting of characters "(","[","{","<",">","}","]",")". The length of the line does not exceed 106 characters.

Output Number of substrings that are RBS.

 Input#1```}<>(){)(<})[] ``` Output#1```4 ```
 Input#2```((><))>{<>}[[]) ``` Output#2```3 ```

Author:
Egor Malyshev
28 april 2009

<PREV | Problem set | Search related messages | NEXT>

 © acm.mipt DevGroupThe page was generated in 210ms