Codeforces 424A (思维题)
来源:互联网 发布:舞蹈培训网络推广方案 编辑:程序博客网 时间:2024/06/05 12:03
Description
Pasha has many hamsters and he makes them work out. Today, n hamsters (n is even) came to work out. The hamsters lined up and each hamster either sat down or stood up.
For another exercise, Pasha needs exactly hamsters to stand up and the other hamsters to sit down. In one minute, Pasha can make some hamster ether sit down or stand up. How many minutes will he need to get what he wants if he acts optimally well?
Input
The first line contains integer n (2 ≤ n ≤ 200; n is even). The next line contains n characters without spaces. These characters describe the hamsters' position: the i-th character equals 'X', if the i-th hamster in the row is standing, and 'x', if he is sitting.
Output
In the first line, print a single integer — the minimum required number of minutes. In the second line, print a string that describes the hamsters' position after Pasha makes the required changes. If there are multiple optimal positions, print any of them.
Sample Input
4
xxXx
1
XxXx
2
XX
1
xX
6
xXXxXx
0
xXXxXx
Source
- Codeforces 424A (思维题)
- CodeForces - 417A(思维题)
- CodeForces 714A 思维题 C
- codeforces 754A(思维题)
- 【codeforces】A. Array(思维水题)
- codeforces-754【A思维】
- Codeforces-298A 思维训练
- Codeforces-297A 思维训练
- CodeForces 359A - Table(思维)
- codeforces 856A (思维)
- Codeforces Round #424 (Div. 2) A Unimodal Array 思维题
- Codeforces Round #353 (Div. 2) A. Infinite Sequence 思维题
- CodeForces - 427A (警察和罪犯 思维题)
- Codeforces Round #337 (Div. 2) A-----思维题
- codeforces 764C Timofey and a tree (思维题)
- Codeforces Round #411 A.Fake NP (思维题)
- 【codeforces】A. The Text Splitting(思维题-水题)
- CodeForces 305A Strange Addition(思维题)
- CodeForces - 417B (思维题)
- CodeForces - 417E(随机数)
- CodeForces - 420A (字符对称问题)
- php多进程学习
- 辗转相除法的证明
- Codeforces 424A (思维题)
- CodeForces - 424B (贪心算法)
- 算法的重要性
- Codeforces 424C(异或)
- CodeForces - 426A(排序)
- CodeForces - 426B(对称图形)
- CodeForces - 427A (警察和罪犯 思维题)
- javascript 图片 懒加载、预加载
- CodeForces - 427B (模拟题)