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 Words
- {
- class Program
- {
- static void Main(string[] args)
- {
- var words = Console.ReadLine()
- .Split(new char[] { ' ', ':', ',', ';', ':', '.', '!', '(', ')', '"',
- '\'', '\\', '/', '[', ']' }, StringSplitOptions.RemoveEmptyEntries)
- .ToList();
- List<string> lowerCaseWords = new List<string>();
- List<string> upperCaseWords = new List<string>();
- List<string> mixedCaseWords = new List<string>();
- foreach (var word in words)
- {
- bool isMixed = false;
- for (int i = 0; i < word.Length; i++)
- {
- if (!Char.IsLetter(word[i]))
- {
- mixedCaseWords.Add(word);
- isMixed = true;
- break;
- }
- }
- if (isMixed == false && word == word.ToUpper())
- {
- upperCaseWords.Add(word);
- }
- else if (isMixed == false && word == word.ToLower())
- {
- lowerCaseWords.Add(word);
- }
- else if (isMixed == false)
- {
- mixedCaseWords.Add(word);
- }
- }
- Console.WriteLine($"Lower-case: {string.Join(", ", lowerCaseWords)}");
- Console.WriteLine($"Mixed-case: {string.Join(", ", mixedCaseWords)}");
- Console.WriteLine($"Upper-case: {string.Join(", ", upperCaseWords)}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement