Please code in OOP C++, show example output to see if no errors Crossword Puzzles An unlabeled crossword is given to you as an N by M grid (3 <= N <= 50, 3 <= M <= 50). Some cells will be clear (typically colored white) and some cells will be blocked (typically colored black). Given this layout, clue numbering is a simple process which follows two logical Steps: Step 1: We determine if a each cell begins a horizontal or vertical clue. If a cell begins a horizontal clue, it must be clear, its neighboring cell to the left must be blocked or outside the crossword grid, and the two cells on its right must be clear (that is, a horizontal clue can only represent a word of 3 or more characters). The rules for a cell beginning a vertical clue are analogous: the cell above must be blocked or outside the grid, and the two cells below must be clear. Step 2: We assign a number to each cell that begins a clue. Cells are assigned numbers sequentially starting with 1 in the same order that you would read a book; cells in the top row are assigned numbers from left to right, then the second row, etc. Only cells beginning a clue are assigned numbers. For example, consider the grid, where '.' indicates a clear cell and '#' a blocked cell. ... #.. ... ..# .## Cells that can begin a horizontal or vertical clue are marked with ! below: !!! #.. !.. ..# .## If we assign numbers to these cells, we get the following; 123 #.. 4.. ..# .## Note that crossword described in the input data may not satisfy constraints typically seen in published crosswords. For example, some clear cells may not be part of any clue. INPUT: The first line of input contains N and M separated by a space. The next N lines of input each describe a row of the grid. Each contains M characters, which are either '.' (a clear cell) or '#' (a blocked cell). OUTPUT: On the first line of output, print the number of clues. On the each remaining line, print the row and column of crossword with assign number to those clues. SAMPLE INPUT 1: 5 3 ... #.. ... ..# .## SAMPLE OUTPUT 1: 4 1 1 1 2 1 3 3 1 SAMPLE INPUT 2: 33 9 ######### ######### ######### ######### ######.## ####.#### ####.#### ####.#### ####.#### ####..... ####.#### ####.#### #.......# ###..#.## ######.## ##.###..# ##.###.## ##.###.## .#.###... .#.###### .#.###### .#.###### .#.###### .#.####.. .#.#####. .#.#####. .#.###### .#.###### .######## .#....... .######## ##.....## ######### SAMPLE OUTPUT 2: 10 6 5 10 5 13 2 13 7 16 3 19 1 19 7 24 9 30 3 32 3

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Please code in OOP C++, show example output to see if no errors

Crossword Puzzles

An unlabeled crossword is given to you as an N by M grid (3 <= N <= 50, 3 <= M <= 50).

Some cells will be clear (typically colored white) and some cells will be blocked (typically colored black). Given this layout, clue numbering is a simple process which follows two logical

Steps:

Step 1: We determine if a each cell begins a horizontal or vertical clue. If a cell begins a horizontal clue, it must be clear, its neighboring cell to the left must be blocked or outside the crossword grid, and the two cells on its right must be clear (that is, a horizontal clue can only represent a word of 3 or more characters). The rules for a cell beginning a vertical clue are analogous: the cell above must be blocked or outside the grid, and the two cells below must be clear.


Step 2: We assign a number to each cell that begins a clue. Cells are assigned numbers sequentially starting with 1 in the same order that you would read a book; cells in the top row are assigned numbers from left to right, then the second row, etc. Only cells beginning a clue are assigned numbers.


For example, consider the grid, where '.' indicates a clear cell and '#' a blocked cell.

...
#..
...
..#
.##


Cells that can begin a horizontal or vertical clue are marked with ! below:

!!!
#..
!..
..#
.##

If we assign numbers to these cells, we get the following;

123
#..
4..
..#
.##

Note that crossword described in the input data may not satisfy constraints typically seen in published crosswords. For example, some clear cells may not be part of any clue.

INPUT:

The first line of input contains N and M separated by a space.

The next N lines of input each describe a row of the grid. Each contains M characters, which are either '.' (a clear cell) or
'#' (a blocked cell).

OUTPUT:

On the first line of output, print the number of clues. On the each remaining line, print the row and column of crossword with assign number to those clues.

SAMPLE INPUT 1:

5 3
...
#..
...
..#
.##

SAMPLE OUTPUT 1:

4
1 1
1 2
1 3
3 1

SAMPLE INPUT 2:

33 9
#########
#########
#########
#########
######.##
####.####
####.####
####.####
####.####
####.....
####.####
####.####
#.......#
###..#.##
######.##
##.###..#
##.###.##
##.###.##
.#.###...
.#.######
.#.######
.#.######
.#.######
.#.####..
.#.#####.
.#.#####.
.#.######
.#.######
.########
.#.......
.########
##.....##
#########

SAMPLE OUTPUT 2:

10
6 5
10 5
13 2
13 7
16 3
19 1
19 7
24 9
30 3
32 3

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY