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.RegularExpressions;
- namespace _01._Valid_Usernames
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] names = Console.ReadLine()
- .Split(", ")
- .ToArray();
- List<string> validNames = new List<string>();
- for (int i = 0; i < names.Length; i++)
- {
- if (names[i].Length >= 3 && names[i].Length <= 16 && names[i].All(c => Char.IsLetterOrDigit(c) || c.Equals('_') || c.Equals('-')))
- {
- validNames.Add(names[i]);
- }
- }
- Console.WriteLine(string.Join(Environment.NewLine, validNames));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement