Getting wrong answer

Could you tell me in detail what i am doing wrong and then explain me how i could have thought the right way or what did i miss , like my assumption was wrong or my base or whatever and what would be the right answer …here is my code :- https://ide.codingblocks.com/s/258047

ok i will check your code. Do you need the correct solution or just the hint of what you were doing wrong?

i will just need the hint for now

Your thinking of the solution approach is right, However it is too complex, thus leading to potential buggy code due to missing some part of the solution
(as an example, at some places you have taken the current and next digit whereas at others you have taken the current and previous digit).

A much simpler way would be to think it in terms of a tree,( as there are 2 options only of taking either single digit or 2 digits hence binary tree) where left subtree denotes taking the current digit while the right will denote taking current and next digit. If on the right tree the number is greater than 26 or less than 10 the leaf node will be null. This way you will have all the permutations at the leaf nodes which you can then sort and display.

ok i am not getting the answer could you correct my code and give me the answer

Okay will send once done

if done , do share the corrected code.

i am giving the implementation of mapped string rest is fine but still check as I have not run this code

class Node {

String dataString; 
Node left; 
Node right; 

Node(String dataString) { 
	this.dataString = dataString; 
	//Be default left and right child are null. 
} 

public String getDataString() { 
	return dataString; 
} 

}

public class mappedString {

public static Node createTree(int data, String pString, int[] arr) { 

	if (data > 26) 
		return null; 

	String dataToStr = pString + alphabet[data]; 

	Node root = new Node(dataToStr); 

	if (arr.length != 0) { 
		data = arr[0]; 

		int newArr[] = Arrays.copyOfRange(arr, 1, arr.length); 

		// left child 
		root.left = createTree(data, dataToStr, newArr); 

		// right child will be null if size of array is 0 or 1 
		if (arr.length > 1) { 
			data = arr[0] * 10 + arr[1]; 
			newArr = Arrays.copyOfRange(arr, 2, arr.length); 
			root.right = createTree(data, dataToStr, newArr); 
		} 
	} 
	return root; 
}

Take this code and mix it with your code (change variables according to your code) and other brackets.
Also then use the same Collections.sort(res) method but instead store your arraylist res with the leaf nodes.
The code is correct however if still there are an problems it must be because of brackets or different variables.