In Manthan 2011 Problem A, I first wrote a C++ code which did not compile, and it took me one minute to figure out why it did not. I proudly declare that I am a C++ newbie. The following is the relevant part of the code.
for (int i = 0; i < n - 1; ++i)
{
case (order[i])
{
switch 'R':
lr[i + 1] = lr[i] + 1;
break;
switch '=':
lr[i + 1] = lr[i];
break;
switch 'L':
lr[i + 1] = 1;
break;
}
}
for (int i = 0; i < n - 1; ++i)
{
case (order[i])
{
switch 'R':
lr[i + 1] = lr[i] + 1;
break;
switch '=':
lr[i + 1] = lr[i];
break;
switch 'L':
lr[i + 1] = 1;
break;
}
}