The answer lies in your question!
How can I get the repeated string value "ABCDEF"?
I think what you really meant was "how do I detect a repeated
word in a bunch of text?"
The first step would be to break up the input text into a collection of words. Then, check for duplicate entries in the collection, perhaps by counting the occurences of each word. Words that occur more than once are your duplicates.
As you can see, I've broken your complex problem into two somewhat less complex problems. Your job now is to attack each of these problems and break them up into even simpler problems. This is called
stepwise refinement and is at the core of software engineering - you break up a fairly abstract and complex task into a collection of simple and very well defined (and therefore programmable) tasks.
Some things that may help you achieve your goal are the
String.Split() method[
^] and the
C# Dictionary[
^] class which you can use to count occurences of each word you've discovered.
/ravi