#include <bits/stdc++.h>
using namespace std; int main()
{
int n,k;cin>>n>>k;
string s;cin>>s;
int ans[26]={0};
for(int i=0;i<n;i++){
int len=1;
while(len<k&&s[i+1]==s[i]) ++len,++i;
if(len==k) ++ans[s[i]-'a'];
}
cout<<*max_element(ans,ans+26);
return 0;
}

Codeforces Round #533 (Div. 2) B. Zuhair and Strings(字符串)的更多相关文章

  1. Codeforces Round #533 (Div. 2) B. Zuhair and Strings 【模拟】

    传送门:http://codeforces.com/contest/1105/problem/B B. Zuhair and Strings time limit per test 1 second ...

  2. Codeforces Round #533(Div. 2) B.Zuhair and Strings

    链接:https://codeforces.com/contest/1105/problem/B 题意: 给一个字符串和k,连续k个相同的字符,可使等级x加1, 例:8 2 aaacaabb 则有aa ...

  3. Codeforces Round #358 (Div. 2) D. Alyona and Strings 字符串dp

    题目链接: 题目 D. Alyona and Strings time limit per test2 seconds memory limit per test256 megabytes input ...

  4. Codeforces Round #533 (Div. 2)题解

    link orz olinr AK Codeforces Round #533 (Div. 2) 中文水平和英文水平都太渣..翻译不准确见谅 T1.给定n<=1000个整数,你需要钦定一个值t, ...

  5. 水题 Codeforces Round #302 (Div. 2) A Set of Strings

    题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...

  6. Codeforces Round #533 (Div. 2) Solution

    A. Salem and Sticks 签. #include <bits/stdc++.h> using namespace std; #define N 1010 int n, a[N ...

  7. Codeforces Round #533 (Div. 2) C.思维dp D. 多源BFS

    题目链接:https://codeforces.com/contest/1105 C. Ayoub and Lost Array 题目大意:一个长度为n的数组,数组的元素都在[L,R]之间,并且数组全 ...

  8. Codeforces Round #533 (Div. 2) C. Ayoub and Lost Array 【dp】

    传送门:http://codeforces.com/contest/1105/problem/C C. Ayoub and Lost Array time limit per test 1 secon ...

  9. Codeforces Round #533(Div. 2) C.Ayoub and Lost Array

    链接:https://codeforces.com/contest/1105/problem/C 题意: 给n,l,r. 一个n长的数组每个位置可以填区间l-r的值. 有多少种填法,使得数组每个位置相 ...

随机推荐

  1. 【SpringBoot1.x】SpringBoot1.x 缓存

    SpringBoot1.x 缓存 文章源码 JSR107 Java Caching 定义了 5 个核心接口,分别为: CachingProvider 定义了创建.配置.获取.管理和控制多个 Cache ...

  2. 【SpringBoot1.x】SpringBoot1.x 日志

    SpringBoot1.x 日志 日志框架 市面上有很多日志框架,一个日志框架一般包括抽象层和实现. SpringBoot,它的底层是 Spring,而 Spring 框架默认是用 JCL(java. ...

  3. Dubbo 配置的加载流程

    配置加载流程 在SpringBoot应用启动阶段,Dubbo的读取配置遵循以下原则 Dubbo支持了多层级的配置,按照预先定义的优先级自动实现配置之间的覆盖,最终所有的配置汇总到数据总线URL后,驱动 ...

  4. 9. 细节见真章,Formatter注册中心的设计很讨巧

    目录 本文提纲 版本约定 你好,我是A哥(YourBatman). Spring设计了org.springframework.format.Formatter格式化器接口抽象,对格式化器进行了大一统, ...

  5. centos 6.5 下安装RabbitMQ-3.7.28 二进制版本

    centos 6.5 下安装RabbitMQ-3.7.28 二进制版本 安装依赖: yum install -y ncurses-devel socat logrotatewxWidgets-deve ...

  6. Centos 7 杂章

    CentOS-7-x86_64-DVD-2003.iso 下载地址: http://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-DV ...

  7. kubernets之pod的删除方式

    一 删除单个pod 1  删除指定命名空间的指定名称的pod k delete po kubia-manual -n defaultpod "kubia-manual" delet ...

  8. Ubuntu16.04安装MySQL8.0

    1.Ubuntu换源(阿里云) sudo cp /etc/apt/sources.list /etc/apt/sources.list.baksudo vi /etc/apt/sources.list ...

  9. Docker 如何动态给SpringBoot项目传参

    关于SpringBoot配置数据源 在项目开发中,我们往往需要配置多套不同的配置环境例如:本地开发.测试环境.部署环境.每一个环境的数据源配置可能都不同,因此需要写不同的数据源配置.如果用Docker ...

  10. 【Android】关于连续多次点击控件的控制方案(新建监听类)

    参考:防止Android过快点击造成多次事件的三种方法_胖胖的博客-CSDN博客 实现逻辑很简单: 设置限定时间 在用户点击时开始计时 若计时未超过限定时间,则不允许触发点击事件 因还未学习过Rxja ...