Logic is not working after taking user input

the code was working fine with given inputs,but not working with user input,I’ve tried with array also,but nothing works

@uthyasani
hello puspita,
u need to take or ( || ) of both the results ( result if u exclude current element and result if u include ur current element).
if any of the two gives u true then return true (1 ) otherwise return false(0)

@uthyasani
I have made some changes in your code pls check ->