function [stat, summ] = parseS(stat)
stat = ucase(stat);
summ = make(size(stat),"");
indx = find(stat=="(");
if any(indx)
	%stat(indx)=[]
	if (max(indx)+2>max(size(stat)))
		error("Nedostaje ')'");
	end
	summ(indx+1) = stat(indx+1);
	%stat(indx)=[]
	
	indx1 = find(summ(indx+1)==")" | summ(indx+1)=="(");
	if any(indx1)
		error("Prazna zagrada kod:"+stat(indx(indx1(1))));
	end
	
	indx1 = find(stat(indx+2)~=")");
	if any(indx1)
		error("Nedostaje ')' kod:"+stat(indx(indx1(1))+1));
	end
	
	stat([indx;indx+1;indx+2])=[];
	summ([indx-1;indx;indx+2])=[];

end
indx = find(stat==")");
if any(indx)
	error("visak ')'");
end
end