How to find the longest substring in frequency order?

This is best described in the example. Given the paragraph:

The longest string in this paragraph is not the shortest string in the paragraph because it is the longest string in the paragraph

I want to list the order of matching substrings first in frequency and then in length, so in this case it should list (case insensitive)

  • The longest string in
  • the paragraph
  • is not the shortest string in
  • because
  • it is
  • this

The above lists the substrings in order of frequency with which they occur, followed by the length, so it The longest string inrepeats twice and is the longest substring. is not the shortest string inlonger the paragraph, but the paragraphrepeated twice, so it is listed first.

Update (based on observation by AlexC and MattBurland):

, in, , , , , *. , in 3 , 6 (9 ), 9 the paragraph, . , ?

+3
1

, , , , :

string [] myArray = { "the", "longest",.... etc

, , , , , . .

, . , , , , - , , $.

" $this paragraph $ ​​$ $, $ $"

, ​​ , , $ .

0

All Articles