namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int a,b; string number,s,p; b=0; s="";number="";p=""; do { if(p!="") s=s+p+" "; p=Console.ReadLine(); } while (p!=null); for (int i=0; i<=s.Length-1;i++) { if (((Convert.ToChar(s[i])<='9') && (Convert.ToChar(s[i])>='0'))||(i==s.Length-1)) number=number+s[i]; else { a= Convert.ToInt32(number); b=b+a; number=""; } } Console.WriteLine ("Total {0}",b+Convert.ToInt32(number)); s=Console.ReadLine(); } } }