当前位置: 首页 > news >正文

北京专业企业营销网站建设关键词优化软件

北京专业企业营销网站建设,关键词优化软件,设计有关的网站,磁力宝原题链接 纯纯水一下; 昨天晚上的比赛,由于半夜打的,精神状态不好,wa了俩发直接睡觉去了,现在白天写写发现,不难,水中水 模拟题吧,题目怎么说就这么作 Kristina has a string ss…

原题链接

纯纯水一下;

昨天晚上的比赛,由于半夜打的,精神状态不好,wa了俩发直接睡觉去了,现在白天写写发现,不难,水中水

模拟题吧,题目怎么说就这么作

Kristina has a string ss of length nn, consisting only of lowercase and uppercase Latin letters. For each pair of lowercase letter and its matching uppercase letter, Kristina can get 11 burl. However, pairs of characters cannot overlap, so each character can only be in one pair.

For example, if she has the string ss = "aAaaBACacbE", she can get a burl for the following character pairs:

  • s1s1 = "a" and s2s2 = "A"
  • s4s4 = "a" and s6s6 = "A"
  • s5s5 = "B" and s10s10 = "b"
  • s7s7= "C" and s9s9 = "c"

Kristina wants to get more burles for her string, so she is going to perform no more than kk operations on it. In one operation, she can:

  • either select the lowercase character sisi (1≤i≤n1≤i≤n) and make it uppercase.
  • or select uppercase character sisi (1≤i≤n1≤i≤n) and make it lowercase.

For example, when kk = 2 and ss = "aAaaBACacbE" it can perform one operation: choose s3s3 = "a" and make it uppercase. Then she will get another pair of s3s3 = "A" and s8s8 = "a"

Find maximum number of burles Kristina can get for her string.

Input

The first line of input data contains a single integer tt (1≤t≤1041≤t≤104) — the number of test cases.

The description of the test cases follows.

The first line of each test case contains two integers nn (1≤n≤2⋅1051≤n≤2⋅105) and kk (0≤k≤n0≤k≤n) — the number of characters in the string and the maximum number of operations that can be performed on it.

The second line of each test case contains a string ss of length nn, consisting only of lowercase and uppercase Latin letters.

It is guaranteed that the sum of nn over all test cases does not exceed 2⋅1052⋅105.

Output

For each test case, print exactly one integer on a separate line: the maximum number of burles that Kristina can get for her string ss.

Example

input

Copy

 

5

11 2

aAaaBACacbE

2 2

ab

4 1

aaBB

6 0

abBAcC

5 3

cbccb

output

Copy

5
0
1
3
2

Note

The first test case is explained in the problem statement.

In the second test case, it is not possible to get any pair by performing any number of operations.

#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<string>
#include<algorithm>
#include<unordered_map>
#include<map>
#include<cstring>
#include<queue>
#include<set>
#include<stdlib.h>
#define dbug cout<<"hear!"<<endl;
#define rep(a,b) for(int i=a;i<=b;i++)
#define rrep(a,b) for(int j=a;j<=b;j++)
#define per(a,b) for(int i=a;i>=b;i--)
#define pper(a,b) for(int j=a;j>=b;j--)
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 2e5 + 100;
const int  INF = 0x3f3f3f3f;
ll gcdd(ll a, ll b)
{if (b) while ((a %= b) && (b %= a));return a + b;
}
const int mod = 998244353;
ll t, n,m,a,b, c, x, k, cnt,ans, ant, sum, q, p, idx;
ll arr[N], brr[N], crr[N];int main()
{cin >> t;while (t--){cin >> n >> m;string s;cin >> s;map<int, int>mp;rep(0, n - 1){mp[s[i]]++;}ans = 0;for (int i = 'A';i <= 'Z';i++){while (mp[i] && mp[i + 32]){ans++;mp[i]--;mp[i + 32]--;}}for (int i = 'A';i <= 'Z';i++){while (m > 0 && mp[i] - 2 >= 0){ans++;mp[i] -= 2;m--;}}for (int i = 'a';i <= 'z';i++){while (m > 0 && mp[i] - 2 >= 0){ans++;mp[i] -= 2;m--;}}cout << ans<<endl;}
}

 

http://www.yayakq.cn/news/688910/

相关文章:

  • 郑州网站建设招商wordpress主题解压后有多个文件
  • 网站建设 软件服务wordpress网站评论插件
  • 国外 作品集 网站宝塔软件做网站
  • 网站可分析哪个网站专门做灵异文
  • 天河区做网站的公司工程造价定额在哪查
  • 做网站的岗位洛阳专业网站设计开发制作建站公司
  • 免费杂志排版软件丽水网站seo
  • cnzz统计代码放在网站网站开发工程师代码
  • 广州手机网站建设联系电话wordpress 页面内存大
  • 有什么比较好的画册设计网站长沙网站建设优化
  • 女做受网站数据库网页制作教程
  • 好的模板网站推荐西部数码网站管理助手c盘安装
  • 本地集团网站建设内蒙古企业网站建设
  • 婴儿网站模板如何修改响应式网站模板
  • 唐山建设招聘信息网站怎样理解网站建设与开发这门课
  • 山西营销网站建设联系方式wordpress小工具位置
  • 分子信标探针在线设计网站iis wordpress安装教程
  • 多个网站优化怎么做wordpress首页按钮
  • 用python开发网站开发技术郑州seo外包服务
  • 网站seo运营365房产网
  • 化学网站建设推广策略是什么意思
  • 广州网站建设正规公司设计网站推荐提升审美
  • 哈尔滨手机网站建设报价网站开发的现状
  • 360网站外链建设企业服务云平台
  • 衡水建网站费用网站搭建费用
  • 资源网站搭建网站建设属于IT吗
  • 广东建设工程协会网站做企业网站有哪些系统
  • 届毕业设计代做网站wap和app的区别
  • 技术网站源码wordpress仙桃住房和城乡建设部网站
  • 网站备案作用万网建站流程