#Write a Python program to add 'ing' at the end of a given string (length should be at least 3). 
# If the given string already ends with 'ing' then add 'ly' instead if the string length of the given string
# is less than 3, leave it unchanged

def add_string(str1):
    length = len(str1)

    if length > 2:
        if str1[-3:] =='ing':
           str1+= 'ly'
        else:
            str1 += 'ing'
    return str1
print(add_string('ab'))
print(add_string('abc'))
print(add_string('string'))


#Write a Python program to find the first appearance of the substring 'not' and 'poor' from a given string,
#  if 'not' follows the 'poor', replace the whole 'not'...'poor' substring with 'good'.
#  Return the resulting string

def not_poor(str1):
    snot = str1.find('not')
    spoor = str1.find('poor')

    if spoor > snot and snot>0 and spoor>0:
        str1 = str1.replace(str1[snot:(spoor+4)],'good')
        return str1
    else:
        return str1
print(not_poor('the lyrics is not that poor!'))
print(not_poor('the lyrics is poor!'))



