give string second consider occurrence text form second second come immediately come immediately secondreturn array word occurrence second Example 1input text alice good girl good student second goodoutput girlstudentexample 2input text rock second willoutput werock Constraints1 textlength 1000text consist lowercase english letter spacesall word text separate single space1 firstlength secondlength 10first second consist lowercase english letter