36 lines
No EOL
811 B
Python
36 lines
No EOL
811 B
Python
num_actions = int(input(""))
|
|
|
|
my_ammo = 0
|
|
my_score = 0
|
|
|
|
their_ammo = 0
|
|
|
|
for their_action in input(""):
|
|
|
|
if their_action == "R":
|
|
their_ammo += 1
|
|
|
|
if their_action == "R" and my_ammo == 0:
|
|
# print("R", end="")
|
|
my_ammo += 1
|
|
elif their_action == "R" and my_ammo > 0:
|
|
# print("F", end="")
|
|
my_ammo -= 1
|
|
my_score += 1
|
|
elif their_action == "B":
|
|
# print("R", end="")
|
|
my_ammo += 1
|
|
elif their_action == "F" and their_ammo > 0:
|
|
# print("B", end="")
|
|
their_ammo -= 1
|
|
pass
|
|
elif their_action == "F" and their_ammo == 0:
|
|
if my_ammo > 0:
|
|
# print("F", end="")
|
|
my_ammo -= 1
|
|
my_score += 1
|
|
else:
|
|
# print("R", end="")
|
|
my_ammo += 1
|
|
|
|
print(my_score) |