Advertisement
ekostadinov

TryCrossword

Dec 13th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 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. using System.Text.RegularExpressions;
  7.  
  8. namespace _3.CrossWords
  9. {
  10.     class SomeWords
  11.     {
  12.         static void Main()
  13.         {            
  14.             string size = Console.ReadLine();
  15.            
  16.             bool isRow = false;
  17.             byte rows = 0;
  18.             isRow = byte.TryParse(size[0].ToString(), out rows);                      
  19.  
  20.             string currentInput = "";
  21.             string currentAll = "";
  22.             string [] inputArr = new string [] {};
  23.  
  24.             for (int i = 0; i < rows; i++)
  25.             {
  26.                 currentInput = Console.ReadLine();
  27.                 string[] horiz = currentInput.Split('#');
  28.  
  29.                 foreach (var item in horiz)
  30.                 {
  31.                     if (item.Length > 1)
  32.                     {
  33.                         currentAll += item;
  34.                         currentAll += " ";
  35.                     }                    
  36.                 }                
  37.                 //currentAll += " ";  
  38.             }
  39.            
  40.             Console.WriteLine(currentAll);
  41.  
  42.             string[] horizontal = currentAll.Split(' ');
  43.            
  44.             Array.Sort(horizontal);
  45.  
  46.             //foreach (var item in horizontal)
  47.             //{
  48.             //    Console.Write(item + " ");
  49.             //}
  50.  
  51.  
  52.             string final  = " ";
  53.             for (int i = 0; i < horizontal.Length; i++)
  54.             {
  55.                 //if (i == 1)
  56.                 //{
  57.                 //   break;
  58.                 //}
  59.                 if(i == 0)
  60.                 {
  61.                     final = horizontal[i];
  62.                 }                                                        
  63.             }
  64.  
  65.             string addFinal = horizontal.Last().ToString();
  66.             addFinal = horizontal.First().ToString();
  67.  
  68.             Console.WriteLine(final);
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement