Question: ```
list1 -->aaa,bbb,ddd,xyxz,... 
list2-->bbb,ccc,ccc,glk,hkp,.. 
list3> ddd,eee,ffff,lmn,..

```

1. Inside a list the words are sorted
2. I want to remove words which are repeated across the list and print
in sorted order
3. If the words are repeated in same list its valid.
4. In the above case it should print

`aaa-->ccc--> ccc-->eee-->fff-->glk-->hkp-->lmn-->xyxz`

In this case `ccc` is in same list hence it is printed and `bbb` and `ddd` is removed since its across list.

I am not looking for code looking for better way to solve this.Tried searching for 3 hrs so just wanted to know the approach

Answer: 
1. Get an empty list for results
2. Get 3 pointers (or indices) pointing to the beginning of the 3 *sorted* list
3. Compare the words pointed by the 3 pointers, find the smallest and add it to the result list
4. Move each of the 3 pointers until the word pointed is larger than the last added result
5. Do so (3. and 4.) until all the pointers reach the end of the lists
For each list, make a copy of list and store the list in set to remove duplicate string in the same list.

```
e.g. 
list2-->bbb,ccc,ccc,glk,hkp
copy as
set2-->bbb,ccc,glk,hkp,...

```

(This step is for building the following frequency table, you can skip it if you have other way to build the table)

Then use hashtable to make a frequency table which map string s to number of set that contain s.
Using the table, you can check whether a string appear in more than one list or not.

Then you just concat the input word lists, remove those string that appear in more than one list.