Codeforces Beta Round 3


A. Shortest path of the king
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
a8
h1
Output
7
RD
RD
RD
RD
RD
RD
RD
----------------------------------------------------------------------------------------------------
B. Lorry
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 2
2 7
1 3
Output
7
2
----------------------------------------------------------------------------------------------------
C. Tic-tac-toe
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
X0X
.0.
.X.
Output
second
----------------------------------------------------------------------------------------------------
D. Least Cost Bracket Sequence
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
(??)
1 2
2 8
Output
4
()()
----------------------------------------------------------------------------------------------------
