using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
class MainClass {
public static string QuestionsMarks(string str) {
string clean = Regex.Replace(str, @"([^\d\?])", string.Empty);
var matches = Regex.Matches(clean, @"(\d)(\?{3})(\d)");
var results = new List<int>();
foreach (Match m in matches){
int a = Convert.ToInt32(m.Value.First().ToString());
int b = Convert.ToInt32(m.Value.Last().ToString());
results.Add(a+b);
}
string final = results.Count != 0 && results.All<int>(r => r == 10) ? "true" : "false";
return final;
}
// keep this function call here
static void Main() {
Console.WriteLine(QuestionsMarks(Console.ReadLine()));
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter