题目传送门
/*
模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢
题目倒是很长:)
*/
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int MAXN = 2e5 + ;
const int INF = 0x3f3f3f3f;
int cnt[];
char s[MAXN];
int main(void) //Codeforces Round #297 (Div. 2) A. Vitaliy and Pie
{
int n;
while (scanf ("%d", &n) == )
{
scanf ("%s", s); int len = strlen (s);
memset (cnt, , sizeof (cnt));
int ans = ;
for (int i=; i<len; i+=)
{
cnt[s[i-]-'a']++;
if (cnt[s[i]-'A']) cnt[s[i]-'A']--;
else ans++;
}
printf ("%d\n", ans);
}
return ;
}
/*
3
aAbB
4
aBaCaB
5
xYyXzZaZ
*/