-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVAPI01.cpp
More file actions
43 lines (41 loc) · 989 Bytes
/
VAPI01.cpp
File metadata and controls
43 lines (41 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
scanf("%d",&t);
while(t--)
{
int n,ans=0,i,j;
scanf("%d",&n);
char s[2*n];
cin>>s;
vector<char>v;
vector<char>v1;
for(i=0;i<2*n-2;i+=2)
v.push_back(s[i]);
for( i=1;i<2*n-2;i+=2)
v1.push_back(tolower(s[i]));
for(i=0;i<v1.size();i++)
{
for( j=0;j<=i;j++)
{
if(v[j]==v1[i])
{
//cout<<v[j]<<v1[i]<<j<<i<<endl;
v[j]='@';
break;
}
//cout<<i<<j<<" ,"<<endl;
}
if(j>i)
ans++;//cout<<i<<j<<endl;
}
printf("%d\n",ans);
}
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
return 0;
}