Hi, I considered as two graphs one as outer and other as inner. After examining 1st two non repeating string we can determine the path. There can be only one path after that.Can someone please help me to find out where i am missing?

here is my solution link:

i checked with all corner cases… Please provide the testcases used…