¨//#include "bits/stdc++.h";
#include <bits/stdc++.h>
using namespace std;
int findRobot(string map)
{
for (int i = 0; i < map.size(); i++)
{
if (map[i] == 'R')
{
return i;
}
}
return 0;
}
void moveRobot(string* map, int from, int to)
{
map->at(from) = '.';
map->at(to) = 'R';
}
int findClosestCoin(string map, int robot)
{
for (int i = 1; i < map.size(); i++)
{
bool right = false;
bool left = false;
// Onko oikealla kolikko?
if (robot + i < map.size())
{
right = map[robot + i] == '*';
}
// Vasen
if (robot - i > 0)
{
left = map[robot - i] == '*';
}
if (right && left)
{
// Kahden kolikon välissä
return -1;
}
if (right)
{
return robot + i;
}
if (left)
{
return robot - i;
}
}
return -1;
}
int main()
{
int rooms;
string map;
cin >> rooms;
cin >> map;
int steps = 0;
int coins = 0;
int robotPos = findRobot(map);
int closestCoin = findClosestCoin(map, robotPos);
while (closestCoin != -1)
{
steps += abs(closestCoin - robotPos);
coins++;
moveRobot(&map, robotPos, closestCoin);
robotPos = findRobot(map);
closestCoin = findClosestCoin(map, robotPos);
}
cout << steps << " " << coins;
}