【题目描述】
给定一个字符串,在字符串中找到第一个连续出现至少k次的字符。
【输入】
第一行包含一个正整数k,表示至少需要连续出现的次数。1 ≤ k ≤ 1000。
第二行包含需要查找的字符串。字符串长度在1到2500之间,且不包含任何空白符。
【输出】
若存在连续出现至少k次的字符,输出该字符;否则输出No。
【输入样例】
3 abcccaaab
【输出样例】
c
#if(1)
#include <iostream>
using namespace std;
int i;
#include <stdio.h>
#include <cstring>
#define A 2500+5
int main()
{int n;char ch[A];cin>>n;cin>>ch;int count=1,len=strlen(ch);for(i=0;i<len;i++){if(ch[i]==ch[i+1]){count++;}else{if(count>=n){cout<<ch[i]<<endl;return 0;}count=1;}}cout<<"No"<<endl;return 0;
}
#endif