using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using static System.Console; public class hello{ public static void Main(){ //yukikoder No.289 数字を全て足そう string str = ReadLine().Trim() ; str = Regex.Replace(str,"[^0-9]","");//文字配列(数字のみを抽出) var n = str.Select(x => Convert.ToInt32(x.ToString()));//char -> string -> int //配列要素の総和 WriteLine(n.Sum()); } }