Codeforces Round #242 (Div. 2) A. Squats

时间:2023-03-09 22:56:08
Codeforces Round #242 (Div. 2) A. Squats

注意题目一次只能改变一个松鼠,Pasha can make some hamster ether sit down or stand up.是单数不是复数

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std; int main(){
int n; cin >> n;
string str; cin >> str;
int num = count(str.begin(),str.end(),'X') -n/;
if(num == ) cout<<<<"\n"<<str<<endl;
else{
cout<<abs(num)<<endl;
int cnt = ;
for(int i = ;i < n && cnt<abs(num); ++ i){
if(num > && str[i]=='X'){
str[i]='x';
cnt++;
}
if(num < && str[i]=='x'){
str[i]='X';
cnt++;
}
}
cout<<str<<endl;
}
}