Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- class Program
- {
- static void Main()
- {
- string input = Console.ReadLine();
- string[] numbers = input.Split();
- int N = int.Parse(numbers[0].ToString());
- int M = int.Parse(numbers[1].ToString());
- input = Console.ReadLine();
- StringBuilder sb = new StringBuilder();
- string howMany = "0";
- for (int i = 0; i < input.Length; i++)
- {
- char ch = input[i];
- if (ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T')
- {
- if (howMany == "0") howMany = "1";
- sb.Append(ch, int.Parse(howMany));
- howMany = "0";
- continue;
- }
- howMany += ch.ToString();
- }
- int rowCount = sb.Length / N;
- if (sb.Length % N != 0) rowCount++;
- int padCount = rowCount.ToString().Length;
- int index = 0;
- for(int i = 0; i < rowCount; i++)
- {
- StringBuilder line = new StringBuilder();
- line.Append((i+1).ToString().PadLeft(padCount, ' '));
- for (int j = 0; j < N; j++)
- {
- if (j % M == 0)
- {
- line.Append(" " + sb[index]);
- }
- else
- {
- line.Append(sb[index]);
- }
- index++;
- if (index > sb.Length - 1) break;
- }
- Console.WriteLine(line);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement