Codeforces Beta Round 89 (Div. 2)


A. String Task
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
tour
Output
.t.r
Input
Codeforces
Output
.c.d.f.r.c.s
Input
aBAcAba
Output
.b.c.b
----------------------------------------------------------------------------------------------------
B. Present from Lena
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
Output
    0
  0 1 0
0 1 2 1 0
  0 1 0
    0
Input
3
Output
      0
    0 1 0
  0 1 2 1 0
0 1 2 3 2 1 0
  0 1 2 1 0
    0 1 0
      0
----------------------------------------------------------------------------------------------------
C. Fancy Number
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 5
898196
Output
4
888188
Input
3 2
533
Output
0
533
Input
10 6
0001112223
Output
3
0000002223
----------------------------------------------------------------------------------------------------
D. Caesar's Legions
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1 1 10
Output
1
Input
2 3 1 2
Output
5
Input
2 4 1 1
Output
0
----------------------------------------------------------------------------------------------------
E. Bertown roads
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 8
1 2
2 3
1 3
4 5
4 6
5 6
2 4
3 5
Output
1 2
2 3
3 1
4 5
5 6
6 4
4 2
3 5
Input
6 7
1 2
2 3
1 3
4 5
4 6
5 6
2 4
Output
0
----------------------------------------------------------------------------------------------------
