Перевести код с python на c++ код с табами в закрепе
class FormList:
def __init__(self, n):
self.min = n
self.len = 1
def add(self, new):
old = self.min
self.min = min(self.min, new)
self.len += 1
if self.min < self.len:
self.len -= 1
self.min = old
raise ValueError
n = int(input())
for _ in range(n):
k = int(input())
nums = map(int, input().split())
l = FormList((next(nums)))
out = []
for i in range(k - 1):
s = next(nums)
try:
l.add(s)
except ValueError:
out.append(l.len)
l = FormList(s)
print(len(out) + 1)
print(*out + [l.len])