adjMatrix of size 26x26 to represent the graph.s1 and s2 and add edges between equivalent characters in the adjacency matrix.visited array to keep track of visited nodes during DFS.baseStr and build the answer string by replacing each character with its mapped smallest character.