more spoj solutions using F#