## LCC/Moose '19 Contest 5 J2 - Cereal

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Bob and Steve the cows are eating cereal for breakfast. Being very hungry, Bob decides to steal Steve's cereal while he is looking away. Bob takes a total of one second to check if Steve has a piece of cereal at a certain position and take it if there is. Not wanting to waste his time, he will only check Steve's bowl if he does not already have a piece of cereal in that position. So, if he has a piece of cereal in his bowl, he will move onto the next position, taking no time. He can also only try to steal for as many seconds as Steve is looking away. Bob will steal from left to right, then up to down.

Can you output what Bob's bowl will look like after he is done stealing?

#### Input Specification

The first line of input will contain three integers, , and , the height and width of their bowls, and the number of seconds Steve is looking away.

The next lines will contain characters each depicting Bob's bowl of cereal, with an o meaning there is a piece of cereal and an . meaning it is empty.

The next lines will contain characters each depicting Steve's bowl of cereal, with an o meaning there is a piece of cereal and an . meaning it is empty.

#### Output Specification

Output lines containing characters each depicting Bob's bowl of cereal after stealing from Steve, with an o meaning there is a piece of cereal and an . meaning it is empty.

#### Sample Input 1

3 3 6
...
...
...
o.o
o.o
o.o

#### Sample Output 1

o.o
o.o
...

#### Sample Input 2

3 3 5
ooo
...
...
o.o
o.o
o.o

#### Sample Output 2

ooo
o.o
o..

#### Explanation for Sample 2

Bob does not have to check if Steve has cereal in the first row because his is already filled up. So, he uses his 5 seconds to check and take from the next two rows. However, he runs out of time and cannot take the last one.