Getting wrong answer for alien dictnory problem on geeksforgeeks please help

its the problem to complete the funtion

https://practice.geeksforgeeks.org/problems/alien-dictionary/1

Consider the case: word1=“abc” and word2=“abcd” then, there should not be any edge. But u are creating an edge in ur code.