Valeri_Stanchev's blog

By Valeri_Stanchev, history, 10 years ago, In English

Hello everybody,

I need your help! Given a string S (|S| <= 10^5) consisting of uppercase letters and an integer K (K <= |S|). Consider a set consisting of all uppercase letters. We are to choose some letters from that set and replace their occurences in S with a star ('*'). Our goal is to make at least one star appear in each substring of length K and we need to do this choosing minimum number of different letters from the set. Output the minimum number of letters and the letters in different lines. If multiple solutions exist, we can print any of them. For example, if S="ABA" and K=2, then we can choose either 'A' or 'B' and receive "*B*" and "A*A" respectively.

Thanks in advance! :)

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it