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;
- namespace Regular_Expressions
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- Print01ValidUsernames();
- }
- private static void Print01ValidUsernames()
- {
- var stringText = Console.ReadLine().Split(new string[] { ", "}, StringSplitOptions.RemoveEmptyEntries) ;
- var final = new List<string>();
- foreach (var item in stringText)
- {
- if (item.Count()>=3 &item.Count()<=16)
- {
- foreach (var kvp in item)
- {
- if ( char.IsLetter(kvp)|| kvp =='-' || kvp =='_' ||char.IsDigit(kvp))
- {
- final.Add(item);
- }
- else
- {
- final.Remove(item);
- break;
- }
- }
- }
- }
- foreach (var item in final.Distinct())
- {
- Console.WriteLine(item);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement