Advertisement
Gesh4o

Untitled

Oct 5th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class LongestAreaInArray
  5. {
  6. static void Main()
  7. {
  8. Console.Write("Please insert how many string will be read: ");
  9. int strCount = int.Parse(Console.ReadLine());
  10.  
  11. string[] words = new string[strCount];
  12. int index=0;
  13. int lenght=0;
  14. int currentCount = 0;
  15. int count = 0;
  16. for (int i = 0; i < words.Length; i++)
  17. {
  18. words[i] = Console.ReadLine();
  19. }
  20. for (int i = 0; i < words.Length; i++)
  21. {
  22. if (i==0)
  23. {
  24. index = 0;
  25. lenght = 1;
  26. }
  27. else
  28. {
  29. if (words[i]!=words[i-1])
  30. {
  31. if (currentCount>count)
  32. {
  33. count = currentCount;
  34. index = i;
  35. }
  36. currentCount = 0;
  37. }
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement