Fix in algorith. Simpler input read mechanism. Still not passing!!