当前位置: 首页 > 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/445612/

相关文章:

  • 申请网站网站商标注册在哪个部门申请
  • 容桂免费网站建设公司wordpress文字轮播
  • 苏州旅游必去十大景点seo wordpress theme
  • iis网站属性在哪百度图片搜索引擎
  • 代码网站怎么制作高清图片素材网
  • 网站seo视频教程太原网站上排名
  • 行业网站怎么推广网站的评测系统怎么做的
  • 传统网站模板怎么查看域名是一级还是二级域名
  • 兰州商城网站建设手机版网页开发
  • 公司网站建设高端网站建设网页设计网站模板制作教程
  • 网站空间服务器桂林人论坛电脑版
  • 中象做网站怎么样汉中杨海明
  • 唐山建设集团招聘信息网站注册公司的流程和步骤
  • 贵州高端网站建设国内炫酷的网站首页
  • 几度设计网站如何建立网站建设
  • 威海建设集团信息网站建设银行网站背景图片
  • wild合成版是哪个网站做的新乡做网站公司哪家好
  • 新纪实网站建设给女朋友做网站
  • 做网站吧七牛云cdn加速wordpress
  • 网站开发常用语言比较免费公司企业建站代理
  • 网站运营外包如何做外贸网站
  • 那些网站可以做信息推广建设购物网站的意义
  • 在韶关做网站上海企业建站费用
  • 天柱建设局网站长沙马拉松线上
  • 淄博网站建设 很乱cnetos 7 wordpress
  • 用wordpress做的网站有哪些引流软件下载站
  • 淄博高效网站建设找哪家qq云wordpress
  • 多导航织梦网站模板下载地址免费crm网站不用下载的软件
  • 做秩序册的网站在线视频网站怎么做
  • 昭通做网站公司过年做啥网站能致富