253A.md (1468B)
1 Source: https://codeforces.com/problemset/problem/253/A 2 3 A. Boys and Girls 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 input.txt 16 17 output 18 19 output.txt 20 21 There are *n* boys and *m* girls studying in the class. They should stand in a line so that boys and girls alternated there as much as possible. Let's assume that positions in the line are indexed from left to right by numbers from 1 to *n* + *m*. Then the number of integers *i* (1 ≤ *i* < *n* + *m*) such that positions with indexes *i* and *i* + 1 contain children of different genders (position *i* has a girl and position *i* + 1 has a boy or vice versa) must be as large as possible. 22 23 Help the children and tell them how to form the line. 24 25 Input 26 27 The single line of the input contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 100), separated by a space. 28 29 Output 30 31 Print a line of *n* + *m* characters. Print on the *i*-th position of the line character "B", if the *i*-th position of your arrangement should have a boy and "G", if it should have a girl. 32 33 Of course, the number of characters "B" should equal *n* and the number of characters "G" should equal *m*. If there are multiple optimal solutions, print any of them. 34 35 Examples 36 37 Input 38 39 ``` 40 3 3 41 ``` 42 43 Output 44 45 ``` 46 GBGBGB 47 ``` 48 49 Input 50 51 ``` 52 4 2 53 ``` 54 55 Output 56 57 ``` 58 BGBGBB 59 ``` 60 61 Note 62 63 In the first sample another possible answer is BGBGBG. 64 65 In the second sample answer BBGBGB is also optimal.