Skip to content

Instantly share code, notes, and snippets.

@kedarmhaswade
Last active February 5, 2022 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kedarmhaswade/09f5a6e5f7daad17531d6dc7ebed0ce7 to your computer and use it in GitHub Desktop.
Save kedarmhaswade/09f5a6e5f7daad17531d6dc7ebed0ce7 to your computer and use it in GitHub Desktop.
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