a. Add up the positions of the characters 'L', where the leftmost character in the word has position 1 and the rightmost character has position n. We call this number the L-sum of a word. For each word, the L-sum is a non-negative integer. Furthermore, for every move Eva makes, the L-sum becomes one lower. Indeed, when switching 'L' and 'R', the position of the 'L' that Eva switches becomes one lower. Therefore, since the L-sum cannot become negative, Eva can always do only a finite number of turns.
b. Of all the possible words of length n that Eva considers, the L-sum is the largest with the word 'RR...RL...LL', where all ℓ characters 'L' are on the right side of the word. On the contrary, the L-sum is smallest for the word 'LL...LRR...R', where all ℓ characters 'L' are on the left side of the word. In this word, Eva cannot do any more turns, because there is nowhere an 'L' directly to the right of an 'R'. To compute the difference in L-sums, note that the left-most 'L' in 'RR...RL...LL' and the left-most 'L' in 'L...LRR...R' differ n−ℓ from each other in position. The same is true for all subsequent characters 'L', from left to right. Thus, the difference in L-sum between these two words is ℓ(n−ℓ). We already saw that the L-sum of a word becomes exactly one smaller at each turn: an upper bound on the maximum number of turns is thus ℓ(n−ℓ).
Eva can also actually do ℓ(n−ℓ) turns if she starts with the word 'RR...RL...LL'. For the first n−ℓ turns, she uses only the leftmost 'L', and the result is the word 'LRR...RL...LL' with ℓ−1 times an 'L' on the right side. Next, she chooses the second 'L' from the left, and in n−ℓ turns she makes the word 'LLRR...RL...LL' with ℓ−2 times an 'L' on the right side. Eva does this with all ℓ the characters 'L'. In total, she can take ℓ(n−ℓ) turns before she ends with 'L...LRR...R'.
c. In the previous part of the problem, we already saw that Eva can do at most ℓ(n−ℓ) turns. Consider the function f(ℓ)=ℓ(n−ℓ). This is a quadratic function with zeros at ℓ=0 and ℓ=n. So the maximum is at ℓ=21n. If n is even, then Eva can do as many turns as possible at ℓ=2n. (The number of turns is then f(2n)=41n2.) If n is odd, the maximum of this function is not at an integer value of ℓ and we see that Eva can do as many turns as possible at ℓ=2n−1 and ℓ=2n+1. (The number of turns is then f(2n−1)=f(2n+1)=41(n2−1).)