Question: Here is the starter code: The solution must be solved incorporating the code below. import java.util.*; public class AtoY { public static void main(String[] args)

 Here is the starter code: The solution must be solved incorporating

Here is the starter code:

The solution must be solved incorporating the code below.

import java.util.*; public class AtoY { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[][] tbl = new char[5][5]; int row = -1, col = -1; String inp; for (int i = 0; i   You are given a five-by-five array of cells, some of which contain letters and the others are empty. You need to fill the empty squares with letters so that there is a path moving only horizontally or vertically (not diagonally) at each step that visits all cells with consecutive letters. The letters are lower case 'a' through 'y', and 'a' is present in one of the starting cells For example, a solution to u t a is Another way to describe the correct output is that if you place the cursor over the 'a', then using only the up, down, left, and right arrows you can move the cursor over the letters 'a' through 'y' in order Write a program to solve this problem. The input consists of five lines, each containing a string of five lower case letters from 'a' to 'z' with no spaces. An 'a appears exactly once in the five lines. A 'z' indicates an empty cell. The output is five lines, each containing five characters (without spaces), and the five lines together contain each of the letters 'a' through 'y' according to the rules given above For example, if the input is Z222Z zfzzz Zzzaz then a correct output is ijklm hgpon efqrs dcbat yxwvu If no solution exists, your program should produce no output. If more than one solution exists, print out just one. Your program should terminate in under a minute for any input. Name your program AtoY.  You are given a five-by-five array of cells, some of which contain letters and the others are empty. You need to fill the empty squares with letters so that there is a path moving only horizontally or vertically (not diagonally) at each step that visits all cells with consecutive letters. The letters are lower case 'a' through 'y', and 'a' is present in one of the starting cells For example, a solution to u t a is Another way to describe the correct output is that if you place the cursor over the 'a', then using only the up, down, left, and right arrows you can move the cursor over the letters 'a' through 'y' in order Write a program to solve this problem. The input consists of five lines, each containing a string of five lower case letters from 'a' to 'z' with no spaces. An 'a appears exactly once in the five lines. A 'z' indicates an empty cell. The output is five lines, each containing five characters (without spaces), and the five lines together contain each of the letters 'a' through 'y' according to the rules given above For example, if the input is Z222Z zfzzz Zzzaz then a correct output is ijklm hgpon efqrs dcbat yxwvu If no solution exists, your program should produce no output. If more than one solution exists, print out just one. Your program should terminate in under a minute for any input. Name your program AtoY

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!