codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

888C.md (838B)


      1 Source: https://codeforces.com/problemset/problem/888/C
      2 
      3 C. K-Dominant Character
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 You are given a string *s* consisting of lowercase Latin letters. Character *c* is called *k*-dominant iff each substring of *s* with length at least *k* contains this character *c*.
     22 
     23 You have to find minimum *k* such that there exists at least one *k*-dominant character.
     24 
     25 Input
     26 
     27 The first line contains string *s* consisting of lowercase Latin letters (1 ≤ |*s*| ≤ 100000).
     28 
     29 Output
     30 
     31 Print one number — the minimum value of *k* such that there exists at least one *k*-dominant character.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 abacaba
     39 ```
     40 
     41 Output
     42 
     43 ```
     44 2
     45 ```
     46 
     47 Input
     48 
     49 ```
     50 zzzzz
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 1
     57 ```
     58 
     59 Input
     60 
     61 ```
     62 abcde
     63 ```
     64 
     65 Output
     66 
     67 ```
     68 3
     69 ```