You are viewing a single comment's thread. Return to all comments →
C#
public static void separateNumbers(string s) { var print = "NO"; if (s.Length > 1) { var sequenceStart = string.Empty; for (int i = 0; i < s.Length / 2; i++) { sequenceStart += s[i]; var num = long.Parse(sequenceStart); var sequence = string.Empty; while (s.Length > sequence.Length) { if (!s.StartsWith(sequence)) break; sequence += num; ++num; } if (s.StartsWith(sequence)) { print = $"YES {sequenceStart}"; } if (s.Length == sequence.Length) break; } } Console.WriteLine(print); }
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
C#