Problem 65. Word Counting and Indexing

Created by Cody Team in Community

You are given a list of strings, each being a list of words divided by spaces. Break the strings into words, then return a master word table of all the words and an indexed version of each string.

The master list should have no repeated entries and should be sorted in alphabetical order.


If str_list = {'one two three','two one four zero'}


  • word_table = {'four','one','three','two','zero'}
  • str_index_list = {[2 4 3],[4 2 1 5]}.

Notice that no words are repeated in word_table, and each string in the string_list can be regenerated by referencing into the word_table using the string_index_list.

Solution Stats

43.7% Correct | 56.3% Incorrect
Last solution submitted on Mar 20, 2019

Problem Comments

Solution Comments

Recent Solvers344

Suggested Problems

More from this Author95

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!