A Smartsheet grid contains single-character cell values. Given a rectangular character matrix board and a target string word, determine whether the word can be formed from adjacent cells.
A word path may move up, down, left, or right. Diagonal movement is not allowed, and the same cell may not be used more than once in one path.
Implement exist_word(board, word):
board, a non-empty rectangular list of lists of one-character strings, and word, a non-empty string.True if some valid path spells word; otherwise, return False.def exist_word(board, word):