Write a program in JAVA to print all the possible combinations of a given String.
Answers
Answered by
0
Answer:
Java Program to Permute All Letters of an Input String
- //Java Program to Print all Possible Permutations of a String.
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- public class PermutationsOfAString {
- // Function to swap two characters.
- static String swap(String str, int i, int j){
- char ch;
- char[] array = str. toCharArray();
Answered by
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