Online Chess Classes | ZugZwang Academy

View Original

Pattern of string | Python Programming

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 = "G*g" 
Output: G*g
        G*
        G
Explanation: Decrease one character
after each line

Solution : Replit

For more updates : Algothink