Jump to content

Rep-string: Difference between revisions

Use new name rep-string
(Undo revision 157607 by Paddy3118 (talk) a regex is just a funny looking method in Perl 6, and even if not, the spec includes "...")
(Use new name rep-string)
Line 1:
{{draft task}}
Given a series of ones and zeroes in a string, define a repeated string or ''rep-string'' as a string which is created by repeating a substring of the ''first'' N characters of the string ''two or more times, truncated on the right to the length of the input string''.
 
For example, the string <code>'10011001100'</code> is a repeated rep-string as the leftmost four characters of <code>'1001'</code> are repeated three times and truncated on the right to give the original string.
 
The task is to:
* Write a function/subroutine/method/... that takes a string and returns an indication of if it is a repeated rep-string and the repeated string. (Either the string that is repeated, or the number of repeated characters would suffice).
* Use the function to indicate the repeating substring if any, in the following
<pre>'1001110011'
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.