public static void main(String args[]) {
        PalindromePair palindromePair = new PalindromePair();
        String[] words = {"bat", "tab"};
        List<List<Integer>> result = palindromePair.palindromePairs(words);
        System.out.println(result);
        String[] words1 = {"abcd", "dcba", "lls", "s", "sssll"};
        result = palindromePair.palindromePairs(words1);
        System.out.println(result);
        String[] words2 = {"", "abcd", "abba"};
        result = palindromePair.palindromePairs(words2);
        System.out.println(result);
        String[] words3 = {"a","abc","aba",""};
        result = palindromePair.palindromePairs(words3);
        System.out.println(result);
        String[] words4 = {"abcd","dcba","lls","s","sssll"};
        result = palindromePair.palindromePairs(words4);
        System.out.println(result);
    }
Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list,
so that the concatenation of the two words, i.e. words[i] + words[j] is a palindrome.

Solution -
First keep mapping of word and its index.
Then iterate through every word and split it into every possible 2 substring. Then if first substring is palindrome
and reverse of second substring is in map means you can form a palindrome by combing this word with the word
in the map.

Time complexity is O(n*k*k)

Reference
https://leetcode.com/problems/palindrome-pairs/
src/com/interview/string/PalindromePair.java