added naive implementation of the substring problem