Given a string, the program must display the shortest path which will print the string over the screen using that shortest path.
Like screen will store alphabets in the format
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Input: HUP Output : Move Down Move Down Move Down destination reached Move Left Move Left Move Down Move Down Move Down destination reached Move Up destination reached
这里使用的方法是将字符存储在n x n矩阵中,并执行以下操作 −
If row difference is negative then move up If row difference is positive then move down If column difference is negative then go left If column difference is positive then we go right
START Step 1 -> Declare Function void printpath(char str[]) Declare variable int i = 0 and cx=0 and cy=0 Loop While str[i] != '