4DM3M

LR8

Dec 29th, 2021
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Drafty
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string[] source = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
  10.  
  11.             if (source.Length == 1)
  12.             {
  13.                 Console.WriteLine(0);
  14.                 return;
  15.             }
  16.  
  17.             if (source.Length == 0)
  18.             {
  19.                 Console.WriteLine("Входных данных не обнаружено");
  20.                 return;
  21.             }
  22.  
  23.             int min = source[0].Length, minNom = 0;
  24.  
  25.             for (int i = 1; i < source.Length; i++)
  26.             {
  27.                 if (source[i].Length < min)
  28.                 {
  29.                     min = source[i].Length;
  30.                     minNom = i;
  31.                 }
  32.             }
  33.  
  34.             Console.WriteLine(source[minNom]);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment