Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace _8.Match_Numbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- string numbers = Console.ReadLine();
- Regex regex =new Regex(@"(^|(?<=\s))-?\d+(\.\d+)?($|(?=\s))");
- MatchCollection collection = regex.Matches(numbers);
- foreach (var item in collection)
- {
- Console.Write("{0} ",item );
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement