codeforces/604C_thinking.py
def calculate(self):
        """ Main calcualtion function of the class """

        result = 1
        empty = 0
        prev = self.s[0]
        for i in range(1, self.n):
            cur = self.s[i]
            if cur != prev:
                result += 1
            else:
                empty += 1
            prev = cur
        result += min(empty, 2)

        return str(result)
 Main calcualtion function of the class 
Main calcualtion function of the class
Main calcualtion function of the class
def calculate(self):
        result = 1
        empty = 0
        prev = self.s[0]
        for i in range(1, self.n):
            cur = self.s[i]
            if cur != prev:
                result += 1
            else:
                empty += 1
            prev = cur
        result += min(empty, 2)
        return str(result)
def calculate ( self ) : result = 1 empty = 0 prev = self . s [ 0 ] for i in range ( 1 , self . n ) : cur = self . s [ i ] if cur != prev : result += 1 else : empty += 1 prev = cur result += min ( empty , 2 ) return str ( result )
Main calcualtion function of the class
Main calcualtion function of the class
""" Main calcualtion function of the class """
self