Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Numerics;
- namespace SoftuniExercisesWithVariables
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter the length of the sequences: ");
- int length = int.Parse(Console.ReadLine());
- string userInput = "";
- int firstElement;
- int biggestArraySub = 0;
- string biggestSeq = "";
- int currentSubsequence = 0;
- int currentSubsequence2 = 0;
- while((userInput = Console.ReadLine()) != "Clone them!")
- {
- string[] userInputArray = userInput.Split("!");
- for(int i = 0; i < userInputArray.Length; i++)
- {
- if(userInputArray[i] == "1")
- {
- currentSubsequence += 1;
- }
- else
- {
- if(currentSubsequence > currentSubsequence2)
- {
- currentSubsequence2 = currentSubsequence;
- }
- currentSubsequence = 0;
- }
- }
- if(currentSubsequence2 > biggestArraySub)
- {
- biggestSeq = userInput;
- biggestArraySub = currentSubsequence2;
- }
- currentSubsequence = 0;
- currentSubsequence2 = 0;
- }
- string[] biggestSequence = biggestSeq.Split("!");
- for(int o = 0; o < biggestSequence.Length; o++)
- {
- Console.Write(biggestSequence[o] + " ");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment