solution is accepted. made too many mistakes on indexing.