Please check this code

3 4 …#. .#… … output is coming as 10 but correct output is 3

refer