Morningstar Interview Question

Find substting of guven string.. oops concepts