408604: GYM103202 D Journey to Un'Goro

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Journey to Un'Gorotime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard output

Recently, you've taken a trip to Un'Goro.

A small road in Un'Goro has attracted your eyes. The road consists of $$$n$$$ steps, each colored either red or blue.

When you go from the $$$i$$$th step to the $$$j$$$th, you count the number of red steps you've stepped. You will be satisfied if the number is odd.

"What is the maximum number of pairs $$$(i, j)$$$ $$$(1 \leq i \leq j \leq n)$$$, such that I'll be satisfied if I walk from the $$$i$$$th step to the $$$j$$$th?" you wonder. Also, how to construct all colorings such that the number of pairs is maximized?

Input

The only line contains an integer $$$n$$$ $$$(1 \le n \le 10^5)$$$, indicating the number of steps of the road.

Output

Output an integer in the first line, denoting the maximum number of pairs that make you satisfied.

Each of the following several lines contains a string with length $$$n$$$ that represents a coloring scheme, in lexicographically ascending order. The $$$i$$$th character is the color of the $$$i$$$th step, where r is for red and b for blue.

If there are more than $$$100$$$ different colorings, just find the lexicographically smallest $$$100$$$ colorings.

Note that in lexicographical order, b is ordered before r.

ExamplesInput
1
Output
1
r
Input
2
Output
2
br
rb
rr
Input
3
Output
4
brb
rbr
rrr

加入题单

上一题 下一题 算法标签: