sub string counter : getting wrong answet