ChemComp[comp_]:=Module[{cmpstr,oncps,ns,lns,str,spos,i,elnum,elt,els,cmpsn},
cmpstr=ToString[comp];
oncps=If[LetterQ[StringTake[cmpstr,-1]],Append[First[#]&/@StringPosition[cmpstr,_?LetterQ~~_?UpperCaseQ],StringLength[cmpstr]],First[#]&/@StringPosition[cmpstr,_?LetterQ~~_?UpperCaseQ],StringLength[cmpstr]];
ns=StringInsert[cmpstr,"1",oncps+1];
spos=StringPosition[ns,_?DigitQ~~_?LetterQ];
lns=Length[spos];
str[1]=StringTake[ns,spos[[1]][[1]]];
str[i_]:=StringTake[ns,{spos[[i-1]][[2]],spos[[i]][[1]]}];
elnum=Join[Table[str[i],{i,lns}],{StringTake[ns,{spos[[lns]][[2]],StringLength[ns]}]}];
elt=Flatten[#,1]&@{StringSplit[#,_?DigitQ],ToExpression[#]&@StringSplit[#,_?LetterQ]}&/@elnum;
els=Union[Transpose[elt][[1]]];
cmpsn={#,Total[#]&@(elt[[#]][[2]]&/@(First[#]&/@Position[elt,#]))}&/@els;
{cmpsn,Total[#]&@(ElementData[#[[1]],"AtomicWeight"] #[[2]]&/@cmpsn)}];

{ChemComp[C5NHOCo3CoO],ChemComp[CH3COOH],ChemComp[WIN],ChemComp[CH3COCH2COCH3]}