added logic, but not working correctly
added working logic, but checked as wrong answer