SHARE
TWEET

Untitled

a guest Mar 24th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Text.RegularExpressions;
  7.  
  8. namespace _8.Match_Numbers
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             string numbers = Console.ReadLine();
  15.             Regex regex =new Regex(@"(^|(?<=\s))-?\d+(\.\d+)?($|(?=\s))");
  16.             MatchCollection collection = regex.Matches(numbers);
  17.             foreach (var item in collection)
  18.             {
  19.                 Console.Write("{0} ",item );
  20.             }
  21.             Console.WriteLine();
  22.         }
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top