On Aug 19, 2020, at 1:07 AM, 洪嘉鴻 <[email protected]> wrote: > > Hello everyone: > I use golang with Win10. The version of golang which I'm using is go1.15. > I want to find out the repeated string. > For example, given a string which is "1134534534534534". > I want the output string to be "345" > I've tried to > Could anyone help me to solve this problem?
Your problem specification is ambiguous. For example, if you may be able represent your input string as ...S^N... or ...T^M... or ...U...V..U..V..V.. where there are U occurs L times and V occurs K times. Here S, T, U and V are substrings Then any of the following possible answers may make sense: 1. S if len(S) > len(any T) 2. T if M > N (T occurs more frequently than any S) 3. U if len(U) > len(any V) 4. V if K > L (V occurs more frequently than any U) Based on your example it appears you want 2. or 4. but can't be sure. Specify the problem clearly & completely and the solution will usually suggest itself! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/62DA1B47-04CD-4B21-8F32-A0A907983757%40iitbombay.org.
