Repeated StringProblem code: REPSTR |
All submissions for this problem are available.
Given a string S (containing at most 105 lowercase English letters). You are requested to find out from continuous substrings a string having length from L to H, which appears the most times; if there are more than one answer, find the most length.
Input
There are several test cases (fifteen at most), each formed as follows:
- The first line contains two positive integers L, H.
- The second line contains the string S.
Output
For each test case, output on a line two integers which are the number of times appearing and the length of the found string, respectively.
Example
Input: 3 5 aabcbcbca 3 5 baaaababababbababbab 1 4 abcd 0 0 Output: 2 4 6 3 1 4
Explanation
Case #1: bcbc occurs twice - at position 3 and position 5 (occurrences may overlap).Case #2: bab occurs 6 times.
Case #3: abcd occurs 1 time.
| Author: | anhdq |
| Date Added: | 22-08-2011 |
| Time Limit: | 10 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

What is the range of L and
Giving an upper bound on L
I got stuck in reading S of
@avinash read char by char to
What is maximum total length
is it allowed to talk on algo
Can H-L be as large as 10^5 ?
what is the range of l and h
0 < L <= H < |S|
sorry, it should be 0 < L <=
is |S| = 0 allowed and if
i have got nzec error in
i have got the same output as
exception is the nzec runtime
@karthikccet It usuallys
please can u tell me clearly
You are requested to find out
what does this runtime error
in c++
@taneja_stud it means
does
Although i have solved this
i've been getting seg faults
I have used just 1 nested for
@migdal.....thnx dude
I think number of test cases
@budabudimir Read Question
@phantom11, No complexity
I tried the program in Java ,
@matheravadi, as far as i
@gunjanbansal: this problem
@s1a3 Many have solved this
do the substrings have to be
@s1a3: I think you're wrong
WooHoo! Finally after 5 days
how to submit the code