PY
py
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
"""
X layers V pattern - Help me solve this in any language please
XLayers V Pattern - StringThe program must accept a string S and an integer X as the input.
The program must print the X Layers V Pattern based on the following conditions.
- The string S must be printed diagonally from the top-left to the bottom-middle X times(one below the other).
- Similarly, the string S must be printed diagonally from the top-right to the bottom-middle X times(one below the other).
- The empty spaces must be printed as asterisks.
''Boundary Condition(s):3 <= Length of S <= 1001 <= X <= Length of SInput Format:
The first line contains S.The second line contains X.Output Format:The lines contain the X Layers V Pattern as shown in the Example Input/Output section.
Example Input/Output 1:
Input:
packing
3
Output:
p***********p
pa*********ap
pac*******cap
*ack*****kca*
**cki***ikc**
***kin*nik***
****ingni****
*****ngn*****
******g******
Explanation:Here the given string is packing and the value of X is 3.
The string packing is printed diagonally (from the top-left to t
"""
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run