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 ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> numbers = Console.ReadLine()
- .Split(new char[] { ',', '.', ';', ':', '!', ' ', '"', '\\', '/', '[', ']', '(', ')', '\'' })
- .ToList();
- List<string> lowerCase = new List<string>();
- List<string> mixedCase = new List<string>();
- List<string> upperCase = new List<string>();
- foreach (var symbol in numbers)
- {
- bool lower = false;
- bool mixed = false;
- bool upper = false;
- foreach (char letter in symbol)
- {
- if (symbol != "" && symbol != " ")
- {
- if (letter >= 'a' && letter <= 'z')
- {
- lower = true;
- }
- else if (letter >= 'A' && letter <= 'Z')
- {
- upper = true;
- }
- else
- {
- mixed = true;
- }
- }
- }
- if (symbol != "" && symbol != " ")
- {
- if (lower && !mixed && !upper)
- {
- lowerCase.Add(symbol);
- }
- else if (!lower && !mixed && upper)
- {
- upperCase.Add(symbol);
- }
- else
- {
- mixedCase.Add(symbol);
- }
- }
- }
- Console.WriteLine($"Lower-case: {string.Join(", ", lowerCase)}");
- Console.WriteLine($"Mixed-case: {string.Join(", ", mixedCase)}");
- Console.WriteLine($"Upper-case: {string.Join(", ", upperCase)}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment