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

网站优化对企业有什么好处手机上做网站的软件

网站优化对企业有什么好处,手机上做网站的软件,mysql asp网站,网站建设+网络科技公司原题链接 纯纯水一下; 昨天晚上的比赛,由于半夜打的,精神状态不好,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/431914/

相关文章:

  • 软件开发公司网站模板广州市天河区建设局网站
  • 廊坊做网站优化的公司上海人才招聘信息最新招聘信息
  • 沈阳市建设工程质量检测中心网站建站至尊
  • 哪个网站能买到做披萨的芝士正宗企业类网站源码
  • 网站推广方式组合it行业软件开发
  • 永州本地网站建设中小企业网站功能
  • 长治做网站哪里不错天津效果图制作公司
  • 网站源码怎么下载学生个人网页制作代码模板
  • 做家常便饭网站团员登录系统智慧团建
  • 崇川网站建设新媒体营销和网络营销的区别
  • 网站seo应用网上国网app
  • 恩施做网站多少钱百度广告推广价格
  • 建设黄页大全网站入口河南做网站哪个平台好
  • 深圳在哪些网站找什么好处深圳燃气
  • 运动健身类网站开发网站后台的搭建
  • 长沙网站建设定制营销咨询公司排名
  • 闵行网站设计海南省交通工程建设局网站
  • 简述建设网站的具体步骤百度网址大全首页链接
  • 设计门户网站在家做私房菜的网站
  • 老干局网站建设方案巫山那家做网站
  • 重庆云诚度网站建设磁力搜索神器
  • 律师事务所东莞网站建设js跳转网站
  • 乌市昌吉州建设局网站公司官网域名怎么注册
  • 现在网站开发用什么语言输入文字自动生成图片
  • 医疗机构网站wordpress脚本演示功能
  • 网页制作与网站建设论文站内营销推广方式
  • 株洲专业网站排名优化信息平台网站的建设 文档
  • 门户网站编辑流程电话号码查询公司单位
  • 曲阜做网站开发公司复工复产工作方案
  • 免费cms建站五指小网站发布要怎么做