题目描述
Given a string S of length N, find the pattern of the strings as shown below in the examples.
Example 1:
Input: S = "GeeK"
Output: Geek
Gee
Ge
G
Explanation: Decrease one character
after each line
ââ¬â¹Example 2:
Input: S = "Gg"
Output: Gg
G*
G
Explanation: Decrease one character
after each line
Your Task:
You don't need to read input or print anything. Your task is to complete the function pattern() which takes the string S as inputs and returns the answer as a list of strings.
Expected Time Complexity: O(N^{2})
Expected Auxiliary Space: O(N^{2})
Constraints:
1 ≤ N ≤ 10^{3}
输入格式
见题面
输出格式
见题面
样例输入
S = "GeeK"
样例输出
Geek
Gee
Ge
G