Finding the best Wordle starting word
(it's "pares")
How does it work
I've made a simple C++ program that loops through the possible words list & finds the best word based on the frequency.
Pseudocode
1. Create 5 arrays/maps (l1, l2, l3, l4, l5) to store the frequency of each letter in the words
2. Create a vector 'words' to store all the words
3. In the main function:
a. Open the file containing the possible words and read from it. You can get it from here.
b. For each word:
i. Increment the frequency of the first letter in l1
ii. Increment the frequency of the second letter in l2
iii. Increment the frequency of the third letter in l3
iv. Increment the frequency of the fourth letter in l4
v. Increment the frequency of the fifth letter in l5
vi. Add the word to the 'words' vector
c. Initialize 'maxfreq' to 0 and 'maxFreqWord' to an empty string
d. Iterate through the 'words' vector:
i. Make sure that the word doesn't have repeated characters
ii. Calculate the total frequency of the letters in the current word
iii. If the total frequency is greater than 'maxfreq':
1. Update 'maxfreq' to the total frequency
2. Update 'maxFreqWord' to the current word
e. Print the 'maxFreqWord'
4. Close the input file and return 0 to indicate successful program execution
Result
By running the code, we found out that the best starting word is "pares", with a frequency of 12036 and no repeated characters.