logo AlgoBeat OnlineJudge
登录 注册

#217698. [PacNW 2025] Shh

内存限制:2048 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Theo needs to change his leaked password. Because he likes to say his password aloud while typing it, he wants the new password to contain exactly occurrences of the substring shh.

A substring is a contiguous segment of a string. Two occurrences are different if they begin or end at different positions, even if their contents are identical.

Given Theo's original password, find the minimum number of characters he must change to obtain exactly occurrences of shh. Also count the distinct passwords obtainable by changing exactly that many characters and containing exactly occurrences.

输入格式

The first line contains two integers and ( and ).

The second line contains Theo's original password, a string of lowercase English letters.

输出格式

Let be the minimum number of changed characters and the number of valid passwords at that distance. Output and .

样例

样例输入 1

10 2
eurovision

样例输出 1

5 4

样例输入 2

8 1
sixseven

样例输出 2

2 2

样例输入 3

3 0
shh

样例输出 3

1 8

样例输入 4

2 0
no

样例输出 4

0 1

样例输入 5

10 0
wastedlove

样例输出 5

0 1

样例输入 6

18 6
countingsatellites

样例输出 6

18 1

样例输入 7

22 5
notanotherconstructive

样例输出 7

13 19

样例输入 8

14 3
honkaistarrail

样例输出 8

8 13

数据范围与提示

In the first sample, at least five characters must be changed. The four valid passwords are shhovishhn, eshhvishhn, eushhishhn, and eurshhshhn.