there is a terms exception handling but i have simplified our code very simple way

now you can check the result

i have done with Apple only you should use others; the problem was didn't gave...