# ALDS1_3_D Areas on the Cross-Section Diagram

s = input()
s = list(s)  # 地形リスト

s1 = []  # \ リスト


class S2:
    # 池の位置と大きさのリスト
    def __init__(self):
        self.point = []
        self.size = []

    def append(self, x, y):
        lake_size = y
        if not self.point:  # 一番最初の池の処理
            self.point.append(x)
            self.size.append(lake_size)
        else:
            if self.point[-1] < x:
                self.point.append(x)
                self.size.append(lake_size)
            else:
                while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                self.point.append(x)
                self.size.append(lake_size)
        # print('append point:{} append size:{}'.format(self.point, self.size))
        return self

    def pop(self):
        x = self.point.pop()
        y = self.size.pop()
        return x, y

    def sum_size(self):
        sum_size = sum(self.size)
        return sum_size


s2 = S2()

for i in range(len(s)):
    if s[i] is '\\':
        s1.append(i)
    elif s[i] is '/':
        if s1:  # S1が空ではない場合
            lake_point = s1.pop()
            lake_size = i - lake_point
            # print('point : {} size : {}'.format(lake_point, lake_size))

            s2.append(lake_point, lake_size)

total = s2.sum_size()
lake_num = len(s2.size)

# print('total size : {} number of lakes : {}\nlake size\n{}'.format(total, lake_num, s2.size))
print(total)
print(lake_num, end='')
for i in range(len(s2.size)):
    print('', s2.size[i], end='')
print('')

 s = input() s input() input s = list(s) s list(s) list s s1 = [] s1 [] class S2:
    # 池の位置と大きさのリスト
    def __init__(self):
        self.point = []
        self.size = []

    def append(self, x, y):
        lake_size = y
        if not self.point:  # 一番最初の池の処理
            self.point.append(x)
            self.size.append(lake_size)
        else:
            if self.point[-1] < x:
                self.point.append(x)
                self.size.append(lake_size)
            else:
                while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                self.point.append(x)
                self.size.append(lake_size)
        # print('append point:{} append size:{}'.format(self.point, self.size))
        return self

    def pop(self):
        x = self.point.pop()
        y = self.size.pop()
        return x, y

    def sum_size(self):
        sum_size = sum(self.size)
        return sum_size S2 def __init__(self):
        self.point = []
        self.size = []

     __init__ self.point = [] self.point self point [] self.size = [] self.size self size [] self self def append(self, x, y):
        lake_size = y
        if not self.point:  # 一番最初の池の処理
            self.point.append(x)
            self.size.append(lake_size)
        else:
            if self.point[-1] < x:
                self.point.append(x)
                self.size.append(lake_size)
            else:
                while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                self.point.append(x)
                self.size.append(lake_size)
        # print('append point:{} append size:{}'.format(self.point, self.size))
        return self

     append lake_size = y lake_size y if not self.point:  # 一番最初の池の処理
            self.point.append(x)
            self.size.append(lake_size)
        else:
            if self.point[-1] < x:
                self.point.append(x)
                self.size.append(lake_size)
            else:
                while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                self.point.append(x)
                self.size.append(lake_size)
        # print('append point:{} append size:{}'.format(self.point, self.size))
         not self.point self.point self point self.point.append(x) self.point.append self.point self point append x self.size.append(lake_size) self.size.append self.size self size append lake_size if self.point[-1] < x:
                self.point.append(x)
                self.size.append(lake_size)
            else:
                while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                self.point.append(x)
                self.size.append(lake_size)
        # print('append point:{} append size:{}'.format(self.point, self.size))
         self.point[-1] < x self.point[-1] self.point self point -1 x self.point.append(x) self.point.append self.point self point append x self.size.append(lake_size) self.size.append self.size self size append lake_size while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                 self.point[-1] > x self.point[-1] self.point self point -1 x self.point.pop() self.point.pop self.point self point pop lake_size += self.size[-1] lake_size self.size[-1] self.size self size -1 self.size.pop() self.size.pop self.size self size pop if not self.point:
                        break
                 not self.point self.point self point break self.point.append(x) self.point.append self.point self point append x self.size.append(lake_size) self.size.append self.size self size append lake_size return self self self self x x y y def pop(self):
        x = self.point.pop()
        y = self.size.pop()
        return x, y

     pop x = self.point.pop() x self.point.pop() self.point.pop self.point self point pop y = self.size.pop() y self.size.pop() self.size.pop self.size self size pop return x, y return x, y x y self self def sum_size(self):
        sum_size = sum(self.size)
        return sum_size sum_size sum_size = sum(self.size) sum_size sum(self.size) sum self.size self size return sum_size sum_size self self s2 = S2() s2 S2() S2 for i in range(len(s)):
    if s[i] is '\\':
        s1.append(i)
    elif s[i] is '/':
        if s1:  # S1が空ではない場合
            lake_point = s1.pop()
            lake_size = i - lake_point
            # print('point : {} size : {}'.format(lake_point, lake_size))

            s2.append(lake_point, lake_size) i range(len(s)) range len(s) len s if s[i] is '\\':
        s1.append(i)
    elif s[i] is '/':
        if s1:  # S1が空ではない場合
            lake_point = s1.pop()
            lake_size = i - lake_point
            # print('point : {} size : {}'.format(lake_point, lake_size))

            s2.append(lake_point, lake_size) s[i] is '\\' s[i] s i '\\' s1.append(i) s1.append s1 append i elif s[i] is '/':
        if s1:  # S1が空ではない場合
            lake_point = s1.pop()
            lake_size = i - lake_point
            # print('point : {} size : {}'.format(lake_point, lake_size))

            s2.append(lake_point, lake_size) s[i] is '/' s[i] s i '/' if s1:  # S1が空ではない場合
            lake_point = s1.pop()
            lake_size = i - lake_point
            # print('point : {} size : {}'.format(lake_point, lake_size))

            s2.append(lake_point, lake_size) s1 lake_point = s1.pop() lake_point s1.pop() s1.pop s1 pop lake_size = i - lake_point lake_size i - lake_point i lake_point s2.append(lake_point, lake_size) s2.append s2 append lake_point lake_size total = s2.sum_size() total s2.sum_size() s2.sum_size s2 sum_size lake_num = len(s2.size) lake_num len(s2.size) len s2.size s2 size print(total) print total print(lake_num, end='') print lake_num end='' end '' for i in range(len(s2.size)):
    print('', s2.size[i], end='') i range(len(s2.size)) range len(s2.size) len s2.size s2 size print('', s2.size[i], end='') print '' s2.size[i] s2.size s2 size i end='' end '' print('') print '' s = list(s) list(s) s lake_size = i - lake_point i - lake_point lake_size s = input() input() s s2 = S2() S2() s2 s1 = [] [] s1 lake_point = s1.pop() s1.pop() lake_point total = s2.sum_size() s2.sum_size() total lake_num = len(s2.size) len(s2.size) lake_num class S2:
    # 池の位置と大きさのリスト
    def __init__(self):
        self.point = []
        self.size = []

    def append(self, x, y):
        lake_size = y
        if not self.point:  # 一番最初の池の処理
            self.point.append(x)
            self.size.append(lake_size)
        else:
            if self.point[-1] < x:
                self.point.append(x)
                self.size.append(lake_size)
            else:
                while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                self.point.append(x)
                self.size.append(lake_size)
        # print('append point:{} append size:{}'.format(self.point, self.size))
        return self

    def pop(self):
        x = self.point.pop()
        y = self.size.pop()
        return x, y

    def sum_size(self):
        sum_size = sum(self.size)
        return sum_size class S2:
    # 池の位置と大きさのリスト
    def __init__(self):
        self.point = []
        self.size = []

    def append(self, x, y):
        lake_size = y
        if not self.point:  # 一番最初の池の処理
            self.point.append(x)
            self.size.append(lake_size)
        else:
            if self.point[-1] < x:
                self.point.append(x)
                self.size.append(lake_size)
            else:
                while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                self.point.append(x)
                self.size.append(lake_size)
        # print('append point:{} append size:{}'.format(self.point, self.size))
        return self

    def pop(self):
        x = self.point.pop()
        y = self.size.pop()
        return x, y

    def sum_size(self):
        sum_size = sum(self.size)
        return sum_size S2
# ALDS1_3_D Areas on the Cross-Section Diagram

s = input()
s = list(s)  # 地形リスト

s1 = []  # \ リスト


class S2:
    # 池の位置と大きさのリスト
    def __init__(self):
        self.point = []
        self.size = []

    def append(self, x, y):
        lake_size = y
        if not self.point:  # 一番最初の池の処理
            self.point.append(x)
            self.size.append(lake_size)
        else:
            if self.point[-1] < x:
                self.point.append(x)
                self.size.append(lake_size)
            else:
                while self.point[-1] > x:
                    # print('w self.point:{} x:{}'.format(self.point[-1], x))
                    self.point.pop()
                    lake_size += self.size[-1]
                    self.size.pop()
                    if not self.point:
                        break
                self.point.append(x)
                self.size.append(lake_size)
        # print('append point:{} append size:{}'.format(self.point, self.size))
        return self

    def pop(self):
        x = self.point.pop()
        y = self.size.pop()
        return x, y

    def sum_size(self):
        sum_size = sum(self.size)
        return sum_size


s2 = S2()

for i in range(len(s)):
    if s[i] is '\\':
        s1.append(i)
    elif s[i] is '/':
        if s1:  # S1が空ではない場合
            lake_point = s1.pop()
            lake_size = i - lake_point
            # print('point : {} size : {}'.format(lake_point, lake_size))

            s2.append(lake_point, lake_size)

total = s2.sum_size()
lake_num = len(s2.size)

# print('total size : {} number of lakes : {}\nlake size\n{}'.format(total, lake_num, s2.size))
print(total)
print(lake_num, end='')
for i in range(len(s2.size)):
    print('', s2.size[i], end='')
print('')


