Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Task17
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. /*
  14. String text =
  15. "Они любят хвастаться ловить волны.Они носят модный пляж" +
  16. " носить и использовать такие выражения,как *праведных,и *чувак* они" +
  17. " обычно настолько одержимы,что сами они не замечают никого" +
  18. " еще на пляже.";
  19. */
  20. String text =
  21. "Они любят хвастаться ловить волны.Они носят модный пляж";
  22. Console.WriteLine(text);
  23.  
  24.  
  25. String[] words = text.Split(new Char[] { ' ', ',', '.', ':', ';', '?', '!' });
  26.  
  27.  
  28.  
  29. int smallestWordSize = 100000;
  30. String[] smallest = new String[100];
  31. int addIndex = 0;
  32. for (int i = 0; i < words.Length; i++)
  33. {
  34. if (words[i].Length < smallestWordSize) smallestWordSize = words[i].Length;
  35. }
  36. for (int i = 0; i < words.Length; i++)
  37. {
  38. Console.WriteLine(words[i]);
  39. }
  40. Console.WriteLine(smallestWordSize);
  41.  
  42. String etalon = "";
  43. bool isSmallestEqual = true;
  44. for (int i = 0; i < words.Length; i++)
  45. {
  46. if (words[i].Length == smallestWordSize) { smallest[addIndex] = words[i]; addIndex++; }
  47. }
  48. for (int i = 1; i < addIndex; i++)
  49. {
  50. if (!smallest[i].Equals(smallest[i-1]))
  51. {
  52. isSmallestEqual = false;
  53. break;
  54. }
  55. }
  56. Console.WriteLine(isSmallestEqual);
  57. Console.ReadKey();
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement