Easyway Explanation every step
\nfor word in words:\n            if dfs(word):\n\n\n# Taking word from wods list /array one by one\n\n\ndef dfs(word):\n            for i in range(1, len(word)
```\nfor word in words:\n            if dfs(word):\n```\n\n# Taking word from wods list /array one by one\n\n```\ndef dfs(word):\n            for i in range(1, len(word)):\n```\n.\n# travesing one by character which selecte from word list every time \n\n```\nprefix = word[:i]\n suffix = word[i:]\n```\n.\n# divide the word \n.\n# word =prefix [0:i ] +suffix [i :n]\n.\n```\nif prefix in d and suffix in d:\n                    return True\n\t\t\t\t\t\n         \n```\n# if prefix and suffix present then return ture\n .\n```\n\t\t\t\t\t\n                if prefix in d and dfs(suffix):\n                    return True\n                \n            \n            return False\n```\n \n# or if prefix present then searching suffix parts .if you find suffix is present in wordlist return true\n.\n# else false\n\n```    # Explanation \n#Input: ["cat","cats","catsdogcats","dog","dogcatsdog","hippopotamuses","rat","ratcatdogcat"]\n\n\n    \n>>>>cat \n\nword= cat\nprefix= c suffix= at\nprefix= ca suffix= t\n\n>>>>>cats\n\n\nword= cats\nprefix= c suffix= ats\nprefix= ca suffix= ts\nprefix= cat suffix= s\n\nsending suffix= s\nword= s\n           return dfs suffix= s False\n\n>>>>>>catsdogcats \n\n\nword= catsdogcats\nprefix= c suffix= atsdogcats\nprefix= ca suffix= tsdogcats\nprefix= cat suffix= sdogcats\n\nsending suffix= sdogcats\nword= sdogcats\nprefix= s suffix= dogcats\nprefix= sd suffix= ogcats\nprefix= sdo suffix= gcats\nprefix= sdog suffix= cats\nprefix= sdogc suffix= ats\nprefix= sdogca suffix= ts\nprefix= sdogcat suffix= s\n           return dfs suffix= sdogcats False\nprefix= cats suffix= dogcats\n\nsending suffix= dogcats\nword= dogcats\nprefix= d suffix= ogcats\nprefix= do suffix= gcats\nprefix= dog suffix= cats\nsuffix and prefix both present= dog cats\n         return dfs suffix= dogcats True\n\n>>>>>>dog   \n\nword= dog\nprefix= d suffix= og\nprefix= do suffix= g\n\n>>>>>>dogcatsdog \n\nword= dogcatsdog\nprefix= d suffix= ogcatsdog\nprefix= do suffix= gcatsdog\nprefix= dog suffix= catsdog\n\nsending suffix= catsdog\nword= catsdog\nprefix= c suffix= atsdog\nprefix= ca suffix= tsdog\nprefix= cat suffix= sdog\n\nsending suffix= sdog\nword= sdog\nprefix= s suffix= dog\nprefix= sd suffix= og\nprefix= sdo suffix= g\n           return dfs suffix= sdog False\nprefix= cats suffix= dog\nsuffix and prefix both present= cats dog\n         return dfs suffix= catsdog True\n\n>>>>>> hippopotamuses\n\n\nword= hippopotamuses\nprefix= h suffix= ippopotamuses\nprefix= hi suffix= ppopotamuses\nprefix= hip suffix= popotamuses\nprefix= hipp suffix= opotamuses\nprefix= hippo suffix= potamuses\nprefix= hippop suffix= otamuses\nprefix= hippopo suffix= tamuses\nprefix= hippopot suffix= amuses\nprefix= hippopota suffix= muses\nprefix= hippopotam suffix= uses\nprefix= hippopotamu suffix= ses\nprefix= hippopotamus suffix= es\nprefix= hippopotamuse suffix= s\n\n>>>>rat\n\n\nword= rat\nprefix= r suffix= at\nprefix= ra suffix= t\n\n>>>>> ratcatdogcat\n\n\nword= ratcatdogcat\nprefix= r suffix= atcatdogcat\nprefix= ra suffix= tcatdogcat\nprefix= rat suffix= catdogcat\n\nsending suffix= catdogcat\nword= catdogcat\nprefix= c suffix= atdogcat\nprefix= ca suffix= tdogcat\nprefix= cat suffix= dogcat\n\nsending suffix= dogcat\nword= dogcat\nprefix= d suffix= ogcat\nprefix= do suffix= gcat\nprefix= dog suffix= cat\nsuffix and prefix both present= dog cat\n         return dfs suffix= dogcat True\n         return dfs suffix= catdogcat True\n\n[\'catsdogcats\', \'dogcatsdog\', \'ratcatdogcat\']\n\n \n \n```\n\n\n```\n# python code\nclass Solution(object):\n    def findAllConcatenatedWordsInADict(self, words):\n        """\n        :type words: List[str]\n        :rtype: List[str]\n        """\n        d = set(words)\n        \n        def dfs(word):\n            for i in range(1, len(word)):\n                prefix = word[:i]\n                suffix = word[i:]\n                \n                if prefix in d and suffix in d:\n                    return True\n\t\t\t\t\t\n                if prefix in d and dfs(suffix):\n                    return True\n                \n            \n            return False\n        \n        res = []\n        for word in words:\n            if dfs(word):\n                res.append(word)\n        \n        return res\n\t\t\n```
['Python', 'Python3']