For this Question: Sansa has discovered Theon is at Winterfell. Ramsay is forcing him to apologize to her for supposedly killing her younger brothers. But Sansa will accept the apology string S if it satisfies the following conditions for a given value of N:
<li> String S should have exactly <b>N distinct substrings</b>.
<li> Length of the string should be minimum possible.
<li> Among all shortest strings, S should be lexicographically smallest one.The first and the only line of input contains an integer N.

Constraints
1 <= N <= 300Output the apology string S.Sample Input
3

Sample Output
ab

Explanation: Distinct substrings of ab are: "a", "b", "ab"

Sample Input
7

Sample Output
aaab

Explanation: Distinct substrings of aaab are: "a", "b", "aa", "ab", "aaa", "aab", "aaab", I have written this Solution Code: n  = int(input())
sz = 1
s = "a"
while sz*(sz+1) < 2*n:
    s += chr(97+sz)
    sz += 1
s = list(s)
rem = sz*(sz+1)//2 - n
i,c = 1,1
while i < len(s):
    k = 1
    while k*(k+1) <= 2*rem:
        k+=1
    k-=1
    rem -= k*(k+1)//2
    for j in range(i,i+k):
        s[j]='a'
    i += k
    s[i] = chr(97+c)
    c+=1
    i += 1
print("".join(s)), In this Programming Language: Python, Now tell me if this Code is compilable or not?