Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 4 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 16 Sep 2017 My Price 6.00

longest substring of S

PROBLEM STATEMENT.

You are given a string S. Your task is to find a longest substring of S, which is also the prefix of s and occurs atleast k times in s.

INPUT

The input will contain 3 lines. First line will have an integer n, representing the size of input string.
The second line will contain a string S of length n. The third line will have k, as described in problem statement.

OUTPUT

Output will consist of two lines. The first line will be length of longest such substring.
Print this substring in the second line.

CONSTRAINTS

  • 1 = n = 1000000
  • 1 = k = n
  • All characters in S will be lower-case ('a'-'z') and upper-case('A'-'Z') latin characters, without any spaces.

EXAMPLE

Input

14
abacabacabacab
3

Output

6
abacab

Explanation

String "abacab" is a prefix of s and occurs 3 times in s i.e s[1,6], s[5,10], and s[9,14].

Answers

(5)
Status NEW Posted 16 Sep 2017 02:09 PM My Price 6.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)