public char[] shuffle(char input[]){
		char result[] = new char[input.length];
		
		//create a map of character to its frequency.
		Map<Character, Integer> map = new HashMap<Character,Integer>();
		for(int i=0; i < input.length; i++){
			Integer count  = map.putIfAbsent(input[i], 1);
			if(count != null) {
				count++;
				map.put(input[i], count);
			}
		}
		char newInput[] = new char[map.size()];
		int freq[] = new int[map.size()];
		
		//create a new char array and freq array from map.
		int index = 0;
		for(Entry<Character,Integer> entry :  map.entrySet()){
			newInput[index] = entry.getKey();
			freq[index] = entry.getValue();
			index++;
		}
		//assuming char with ASCII value 0 does not exists in the input
		shuffleUtil(newInput,freq, result, 0, (char)0);
		return result;
	}
Date 07/05/2015
@author Tushar Roy

Given an input with duplicate characters generate a shuffle which does not have 
two duplicate characters together

Do regular permutation with repetition with additional constraint of keeping
duplicates away from each other.
src/com/interview/recursion/FancyShuffle.java