Consider how you could use a Map (for your purposes, a java.util.LinkedHashMap would be a wise choice) to store the relationship between the first and second strings. Since a Map automatically eliminates duplicate keys, and since LinkedHashMap stores the keys in insertion order, it would do virtually all of the work for you. You'd just add all the pairs, allocate new arrays the same size as the map, then iterate over the map and populate the two arrays.
This should be a fun introduction to the Collections family. See the JavaDoc for Map. Some of the methods you'll want to use:
The key-value pairs will come back in a Set of MapEntry objects. Look up the doc for Set, find iterator() and follow the links on Iterator. You can get MapEntry objects with that, and then get all the keys and values from there.
Any time you get stuck, Google for "java map example" or something like that. Start up some code and show us what you make. We can really help you best when you have code that almost works.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi