Please check logic

can you please check the logic in the above code


str.subsrt(index1, index2)
index2 is exclusive i.e. it will give substring from index1 to index2 -1