For this Question: Sara's brother gives her a string representing chocolates and candies in a row. Sara loves eating candies before chocolates so she wants to rearrange the given string so that all the candies come before chocolates. Help her to rearrange the string.
You are allowed only 1 type of operation as many times as you want. You can swap all existing pair of candy and chocolate in a second if they are consecutive and chocolate is before candy, that means in one second you can swap all the i-th value with i+1 if and only if the i-th position has chocolate and the i+1 has candy.
Given the String S, find the minimum time needed to rearrange the given string.Input contains a single line containing the string S.

Constraints:-
1 <= |S| <= 1000000

Note:- String will contain only characters 'M' and 'F' where M represents chocolate while F represents candy.Print the minimum time needed to rearrange the given string such that all candies come before chocolates.Sample Input:-
MMFF

Sample Output:-
3

Explanation:-
MMFF - > MFMF - > FMFM - > FFMM

Sample Input:-
MFMFMF

Sample Output:-
3

Explanation:-
MFMFMF -> FMFMFM -> FFMFMM -> FFFMMM, I have written this Solution Code: n = input()
t = 0
c = 0
for i in range(len(n)):
    if(n[i]=='F'):
        if((i-c)<=t and t!=0):
            t +=1
        else:
            t=i-c
        c +=1
        
print(t), In this Programming Language: Python, Now tell me if this Code is compilable or not?