Good evening. So I have a text file which contains multiple lines of text with separators. I need to find the longest text fragment with a condition, that the word's last letter has to be the first letter of the later word. That text fragment can continue for many lines, not only in one line.
F.e.
We have this string array :
Hello, obvious smile eager ruler.
Rave, eyes, random.
So from these two lines we get that our text fragment will be :
Hello, obvious smile eager ruler.
Rave, eyes
Our text fragment ends at word "eyes" because "random" doesn't start with "s".
Next two lines from our txt file :
Johnny, you use.
Eye eager sun.
So from these two other lines we get that our text fragment will be :
Johnny, you use.
Eye eager
Our text fragment ends at word "eager" because "sun" doesn't start with "r".
So we have multiple lines of text with separators in our input file(txt) and I need to find the biggest text fragment through all that text. That text fragment contains words and separators.
I don't even know where to begin, I guess I'll have to use functions like String.Length, Substring and String.Split, maybe Redex might come handy in there, but I'm not really familiar with Redex and it's functions yet.
I tried to explain it as clearly as I can, English isn't my native language, so it's kinda difficult.
My question is : What kind of an algorythm should I use to break my text into separate strings, where one string contains a word and the separator after that word?