Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Task12
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- if (input != "")
- {
- string[] ops = input.Split(',');
- int[] ans = new int[5];
- string errors = "";
- foreach (var op in ops)
- {
- if (op == "0" || op == "None")
- ans[0]++;
- else if (op == "1" || op == "First")
- ans[1]++;
- else if (op == "2" || op == "Second")
- ans[2]++;
- else if (op == "3" || op == "Third")
- ans[3]++;
- else if (op == "4" || op == "Fourth")
- ans[4]++;
- else
- errors += $"{op},";
- }
- errors = errors.Substring(0, errors.Length - 1);
- Console.WriteLine("Input data types:\n" +
- $"None(0)-{ans[0]}\n" +
- $"First(1)-{ans[1]}\n" +
- $"Second(2)-{ans[2]}\n" +
- $"Third(3)-{ans[3]}\n" +
- $"Fourth(4)-{ans[4]}\n" +
- $"Errors:\n" +
- $"Not valid input strings: {errors}");
- }
- else
- Console.WriteLine("No data");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement