题目链接:http://codeforces.com/contest/424/problem/A

 

#include<iostream>
#include<cstring>
using namespace std;
char str[100000];
int main()
{
int n;
cin>>n;
cin>>str;
int len=strlen(str);
int sum=0;
int ans=0;
for(int i=0; i<len; i++)
if(str[i]=='X')
{
sum++;
}
n=n/2-sum;
if(n>0)
{
for(int i=0; i<len; i++)
{
if(n==0)
{
break;
}
if(str[i]=='x')
{
str[i]='X';
ans++;
n--;
}

}

}
if(n<0)
{

for(int i=0; i<len; i++)
{

if(n==0)
{
break;
}

if(str[i]=='X')
{
str[i]='x';
ans++;
n++;
}

}
}
cout<<ans<<endl;
cout<<str<<endl;
}

posted on 2014-05-13 20:24  虾米小匠  阅读(161)  评论(0)    收藏  举报