Last active
February 5, 2022 18:01
-
-
Save kedarmhaswade/09f5a6e5f7daad17531d6dc7ebed0ce7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package practice; | |
/** | |
* Simple program that generates wordlists of various lengths given certain characters. | |
*/ | |
public class WordList { | |
private static final char[] alphabet = new char[]{ | |
'अ', | |
'आ', | |
'इ', | |
'ई', | |
'उ', | |
'ऊ', | |
'ए', | |
'ऐ', | |
'ओ', | |
'औ', | |
'क', | |
'ख', | |
'ग', | |
'घ', | |
'च', | |
'छ', | |
'ज', | |
'झ', | |
'ट', | |
'ठ', | |
'ड', | |
'ढ', | |
'ण', | |
'त', | |
'थ', | |
'द', | |
'ध', | |
'न', | |
'प', | |
'फ', | |
'ब', | |
'भ', | |
'म', | |
'य', | |
'र', | |
'ल', | |
'व', | |
'श', | |
'स', | |
'ष', | |
'ह', | |
// 'क्ष', // not a character! | |
// 'ज्ञ', // not a character! | |
}; | |
static void printValidGuesses(int len, String w) { | |
if (len == 0) { | |
System.out.println("'" + w + "'" + ","); | |
} else { | |
for (char c : alphabet) { | |
if (w.length() >= 1 && c == w.charAt(w.length() - 1)) { | |
continue; | |
} | |
printValidGuesses(len - 1, w + c); | |
} | |
} | |
} | |
public static void main(String[] args) { | |
printValidGuesses(3, ""); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment