Why my code is wrong which outputs an error
def increment_string(strng):
if strng == '':
return '1'
elif strng.isdigit():
number= int(''.join(filter(str.isdigit,strng)))
return re.sub('\d+',str(number +1),strng)
return strng + str(1)
Output: increment_string("foobar001")
It should return 'foobar002' but it is returning 'foobar0011'