Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ValidUsername
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] usernames = Console.ReadLine().Split(", ");
- for (int i = 0; i < usernames.Length; i++)
- {
- bool isValidLegnth = false;
- bool isValidContent = false;
- string currentUsername = usernames[i];
- if (currentUsername.Length >= 3 && currentUsername.Length <= 16)
- {
- isValidLegnth = true;
- }
- for (int j = 0; j < currentUsername.Length; j++)
- {
- char currentSymbol = currentUsername[j];
- if (char.IsLetterOrDigit(currentSymbol) || currentSymbol == '-' || currentSymbol == '_')
- {
- isValidContent = true;
- }
- else
- {
- isValidContent = false;
- }
- }
- if (isValidContent && isValidLegnth)
- {
- Console.WriteLine(currentUsername);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement