Programming challenge description: In this challenge, you're given a string containing jumbled letters from several concatenated words. Each word is a numeral from zero to nine. Each numeral may be used multiple times in the jumbled string. Write a program that returns integers corresponding to the numerals used to form the jumbled string. Integers must be sorted in ascending order. For example, reuonnoinfe are shuffled letters of the strings one four nine. Your program's output should be 149. Input: A string formed from jumbled letters of numerals. For example:

Respuesta :

Following are the Java program to the given question:

import java.util.*;//import package

public class Jumbledletters //defining Jumbledletters class  

{

public static void main (String[] axv)//defining main method

{

String num[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};//defining an arrayof string

int i,j;

Scanner xc = new Scanner(System.in);//creating Scanner class object to input value

System.out.print("Enter value: ");//print message

String v= xc.next();//defining a String variable that input String value

for(i=0; i<num.length; i++)//defining a loop to count input String length

{

String s = num[i];//defining a string variable to hold array value

boolean f = true;//defining a boolean variable

for(j=0; j<s.length(); j++)//defining a for loop that convets value into integer

{

char c = s.charAt(j);//defining char variable that hold value

if(v.indexOf(c)==-1)//defining if block to check indexOf value

{

f = false;//use boolean variable that hold boolean value

break;//using break keyword

}

}

if(f) //use if to check boolean value

System.out.print (i);//use print method that print i value

}

System.out.println();//use print method for beak line

}

}

Output:  

Enter value: onefournine

149

Explanation of code:

  • Import package.
  • Defining the Jumbledletters class and also define the main method in it.
  • Inside the main method defining a string of array "num" that holds string value and two integer variables "i,j" is defined.
  • In the next step, a scanner class object is declared that inputs the value.
  • After input, a value a for loop is defined that uses a string variable that holds an array value and uses another loop that converts string value into a numeric value.

Learn more:

brainly.com/question/24379089