<prompt> Given an input string and a dictionary, create a function find longest word in dictionary that is a subsequence of the given string.Input string: abppplDictionary: able, apple, sample, abppl, pl  <response>: Here is an example of function that could achieve the desired result in Python:pythondef find_longest_wordstring: str, dictionary: list - str: dictionary sorteddictionary, keylen, reverseTrue for word in dictionary: i 0 for s in string: if i lenword and s wordi: i 1 if i lenword: return word return Examplestring abpppldictionary able, apple, sample, abppl, plprintfind_longest_wordstring, dictionary abpplThe function takes two arguments, string which is a string, and dictionary which is a list. First, it sorts the dictionary in descending order of length. Next, for each word in the dictionary, it checks whether it is a subsequence of the input string. If it is, then that word is returned, otherwise, it returns an empty string. 