using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Soucet_cisel { class Soucet { static void Main(string[] args) { using (System.IO.StreamReader sr = System.IO.File.OpenText("in.txt") { char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; int nSum = 0; string s = ""; while ((s = sr.ReadLine()) != null) { string[] strNums = s.Split(delimiterChars); foreach (string str in strNums) { if (str.Length == 0) continue; nSum += Convert.ToInt32(str); } } System.IO.File.WriteAllText("out.txt", nSum.ToString()); } } } }