Computer Science, asked by TechieGuy, 10 months ago

Write a program in JAVA to print all the possible combinations of a given String.

Answers

Answered by kshitizbitu7256
0

Answer:

Java Program to Permute All Letters of an Input String

  1. //Java Program to Print all Possible Permutations of a String.
  2. import java.io.BufferedReader;
  3. import java.io.InputStreamReader;
  4. public class PermutationsOfAString {
  5. // Function to swap two characters.
  6. static String swap(String str, int i, int j){
  7. char ch;
  8. char[] array = str. toCharArray();
Answered by thamirasalt
0

Answer:

Explanation:

Run a nested loop with 2 for loops

Run the Outer for loop for the entire length of the string and the inner for loop must run with unary decrement operand for the entire length. Have a counter variable of string data type and once the control finishes the inner for loop print the string and also have a counter variable of integer data type to find the number of words

Similar questions