Codeforces Beta Round 99 (Div. 1)


A. Literature Lesson
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
day
may
sun
fun
Output
aabb
Input
1 1
day
may
gray
way
Output
aaaa
Input
2 1
a
a
a
a
a
a
e
e
Output
aabb
Input
2 1
day
may
sun
fun
test
hill
fest
thrill
Output
NO
----------------------------------------------------------------------------------------------------
B. Digits Permutations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
198
Output
981
819
Input
500
Output
500
500
----------------------------------------------------------------------------------------------------
C. Mushroom Gnomes - 2
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
2 2 50 50
1 1
Output
0.5000000000
Input
2 1
2 2 50 50
4 2 50 50
3 1
Output
0.2500000000
----------------------------------------------------------------------------------------------------
D. World of Darkraft
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
RL
LR
Output
LOSE
Input
2 2
RR
RR
Output
WIN
----------------------------------------------------------------------------------------------------
E. Hellish Constraints
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
codeforces
2 0 0
o 1 2
e 1 2
Output
7
Input
codeforces
2 1 1
o 1 2
o 1 2
Output
0
----------------------------------------------------------------------------------------------------
