-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProblem Description.txt
92 lines (73 loc) · 2.32 KB
/
Problem Description.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
We have hired a very creative data analyst that has a theory about predicting
compliance patterns in repeat drunk driving offenders. The analyst would like
a text based "compliance map" based on an MxN field of compliance data. The
analyst is requesting that we show a number in a node that indicates how many
violation events there are in adjacent nodes (violation events are represented
by an * character).
Compliance data will come in the following format:
*....*.
......*
.*..*..
.......
The compliance map for the data above should look like this:
*1001*2
221123*
1*11*21
1111110
You should write a console program that takes input from standard input
as follows:
The input will consist of an arbitrary number of compliance data sets.
The first line of each set contains two integers n and m (0 < n, m <= 100)
which stands for the number of lines and columns of the set respectively.
The next n lines contains exactly m characters and represent the set.
Each compliant node is represented by an "." character (without the quotes)
and each violation node is represented by an "*" character (also without the
quotes). The first set line where n = m = 0 represents the end of input and
should not be processed.
Your program should produce output to standard output as follows:
For each set, you must print the following message in a line alone:
Set #x:
Where x stands for the number of the set (starting from 1). The next n lines
should contain the set with the "." characters replaced by the number of
adjacent violation nodes to that node. There must be an empty line between
set outputs.
Clues
* As you may have already noticed, each node may have at most 8 adjacent nodes
* Make sure your console application can read from standard in (Console.ReadLine)
and writes to standard out (Console.Write)
* There are a couple of test sets in the ComplianceMapper solution folder
(test-input.txt and large-test.txt). If written properly, your console
application should be able to have these text files feed to them from the
command line, like so: your-app.exe < test-input.txt
Suggested Test Cases
This is the acceptance test input:
4 4
*...
....
.*..
....
3 5
**...
.....
.*...
4 7
*....*.
......*
.*..*..
.......
0 0
and output:
Set #1:
*100
2210
1*10
1110
Set #2:
**100
33200
1*100
Set #3:
*1001*2
221123*
1*11*21
1111110