Codeforces Round 306 (Div. 2)


A. Two Substrings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
ABA
Output
NO
Input
BACFAB
Output
YES
Input
AXBYBXA
Output
NO
----------------------------------------------------------------------------------------------------
B. Preparing Olympiad
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 5 6 1
1 2 3
Output
2
Input
4 40 50 10
10 20 30 25
Output
2
Input
5 25 35 10
10 10 20 10 20
Output
6
----------------------------------------------------------------------------------------------------
C. Divisibility by Eight
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3454
Output
YES
344
Input
10
Output
YES
0
Input
111111
Output
NO
----------------------------------------------------------------------------------------------------
D. Regular Bridge
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
YES
2 1
1 2
----------------------------------------------------------------------------------------------------
E. Brackets in Implications
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 1 1 0
Output
YES
(((0)->1)->(1->0))
Input
2
1 1
Output
NO
Input
1
0
Output
YES
0
----------------------------------------------------------------------------------------------------
