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 Task4
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.In.ReadToEnd();
- string[] strings = input.Split('\n');
- char[] MyChar = { '\r', ']', '[' };
- int n = strings.Length - 3;
- int m = strings[1].Split(',').Length - 1;
- int[,] matrix = new int[n, m];
- for (int i = 1; i < strings.Length - 2; ++i)
- {
- string[] str = strings[i].Split(',');
- str[0] = str[0].TrimStart(MyChar);
- str[str.Length - 2] = str[str.Length - 2].TrimEnd(MyChar);
- for (int j = 0; j < str.Length - 1; ++j)
- matrix[i - 1, j] = int.Parse(str[j]);
- }
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- Console.Write($"{matrix[i, j]} ");
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement