Paste #224671

   
pasted on 07.10.2021 01:46
  • Edit to this paste
  • Print
  • Raw
  • Compare it with the parent paste
  • Look at the parent paste
  • Show paste tree
  • Compare with paste
    #  
  • Toggle line numbers
  • Syntax highlighting  
Text paste
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Your program should get two parameters from command line:
-string size N^2, that describes square matrix of characters N*N;
-string that describes given word.

The first string is converting to matrix using the following rule. String "QWEASDZXC" forms the matrix:
['Q','W','E',
 'A','S','D',
 'Z','X','C']

Yor program should print to the console the sequence of cells those build the given word.
Every next character of word can be placed just in the neightbor cell: on the top, on the bottom, on the left or on the right from the cell with previous character.

E.g. if it is given matrhix "QLGNAEKIRLRNGEAE" and word "KING", then sequence of cells will be [1,2]->[1,3]->[0,3]->[0,2]

After solving the task test it carefully with different examples.
Add Comment
Author