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 Task17
- {
- class Program
- {
- static void Main(string[] args)
- {
- /*
- String text =
- "Они любят хвастаться ловить волны.Они носят модный пляж" +
- " носить и использовать такие выражения,как *праведных,и *чувак* они" +
- " обычно настолько одержимы,что сами они не замечают никого" +
- " еще на пляже.";
- */
- String text =
- "Они любят хвастаться ловить волны.Они носят модный пляж";
- Console.WriteLine(text);
- String[] words = text.Split(new Char[] { ' ', ',', '.', ':', ';', '?', '!' });
- int smallestWordSize = 100000;
- String[] smallest = new String[100];
- int addIndex = 0;
- for (int i = 0; i < words.Length; i++)
- {
- if (words[i].Length < smallestWordSize) smallestWordSize = words[i].Length;
- }
- for (int i = 0; i < words.Length; i++)
- {
- Console.WriteLine(words[i]);
- }
- Console.WriteLine(smallestWordSize);
- String etalon = "";
- bool isSmallestEqual = true;
- for (int i = 0; i < words.Length; i++)
- {
- if (words[i].Length == smallestWordSize) { smallest[addIndex] = words[i]; addIndex++; }
- }
- for (int i = 1; i < addIndex; i++)
- {
- if (!smallest[i].Equals(smallest[i-1]))
- {
- isSmallestEqual = false;
- break;
- }
- }
- Console.WriteLine(isSmallestEqual);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement