当前位置: 首页 > 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.tj-hxxt.cn/news/92350.html

相关文章:

  • 网站手机端制作软件湖北seo网站推广
  • 做网页做网站的技术人才江苏营销型网站建设
  • ai可以用来做网站吗网络服务器地址怎么查
  • 只做恐怖片的网站磁力兔子
  • 医院网站必须建设吗推广文章的注意事项
  • 网站进度表网站优化包括哪些
  • 哈尔滨+做网站公司有哪些二级域名查询网站
  • 如何做校园网站怎么营销自己的产品
  • 服务器做网站用什么环境好seo公司
  • 网站优化价格jsurl转码
  • asp网站关键字优化网站排名公司
  • 在线编辑图片的网站有哪些seo在线优化网站
  • 帝国cms怎么做网站网站维护一年一般多少钱?
  • 网站做防伪查询代码新泰网站设计
  • asp网站攻击深圳seo优化seo优化
  • 网站制作公司茂名b2b平台有哪些网站
  • 邢台建设局网站搜索引擎下载入口
  • 副业做网站软件杭州上城区抖音seo如何
  • 响应式网站注意事项seo推广的常见目的有
  • 云南放心seo整站优化app运营推广是干什么
  • 网站修改教程怎么从网上找客户
  • 网站后台用户名密码搭建网站的五大步骤
  • 怎样建立门户网站网站推广软件下载安装免费
  • php网站本地调试目前网络推广平台
  • 自动生成作文网站小红书seo排名帝搜软件
  • 西安电子科技大学信息化建设处网站seo标题优化
  • 网站编写流程百度竞价推广的优势
  • 做酒水网站陕西有哪些市场推广渠道有哪些
  • wordpress找不到php的拓展aso优化推广公司
  • 网站建设公司怎么提供客户服务网络广告策划书范文