3540 - Exactly K Times 3540 - Exactly K Times 3540 - Exactly K Times

Statistics Sub: 340 | AC: 99 | AC%: 29,12 | Score: 1,83
Created by Antonio González Borrego
Added by agborrego (2016-02-27)
Limits
Total Time: 15000 MS | Test Time: 2000 MS |Memory: 256 MB | Output: 64 MB | Size: 16 KB
Enabled languages
Available in

Description

This is a simple task. Given a string S you need to find the length of the longest substring which appears exactly K times in S. If such substring does not exist print -1.
This is a simple task. Given a string S you need to find the length of the longest substring which appears exactly K times in S. If such substring does not exist print -1.
This is a simple task. Given a string S you need to find the length of the longest substring which appears exactly K times in S. If such substring does not exist print -1.

Input specification

The first line of input contain a integer number K (1 <= K <= 1000). The second line of input contains the string S (1 <= |S| <= 1000) composed of lowercase letters of the English alphabet.
The first line of input contain a integer number K (1 <= K <= 1000). The second line of input contains the string S (1 <= |S| <= 1000) composed of lowercase letters of the English alphabet.
The first line of input contain a integer number K (1 <= K <= 1000). The second line of input contains the string S (1 <= |S| <= 1000) composed of lowercase letters of the English alphabet.

Output specification

A single line with the length of the found substring or -1 if it does not exist.
A single line with the length of the found substring or -1 if it does not exist.
The first line of input contain a integer number K (1 <= K <= 1000). The second line of input contains the string S (1 <= |S| <= 1000) composed of lowercase letters of the English alphabet.

Sample input

2
abacaba

Sample output

3

Hint(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recommendation

We have carefully selected several similar problems: 3379 | 3380 | 1721 | 3166 | 3954 | 2378