#include<cstdio> #include<cstring> using namespace std; int main() { int tc,c=1; scanf("%d",&tc); while (tc--) { int n,k,meet[26],cnt=0; char name[510]; scanf("%d %d %s",&n,&k,name); for (int i=0;i<26;i++) meet[i]=-1000; for (int i=0;i<n;i++) { int a=name[i]-'A'; if (meet[a]+k>=i) cnt++; meet[a]=i; } printf("Case %d: %d\n",c++,cnt); } return 0; }
Sunday, July 17, 2016
UVA 12583 Solution
Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment