Guest User

Untitled

a guest
Dec 9th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace P13
  5. {
  6.     class Program
  7.     {
  8.         public static void Main(string[] args)
  9.         {
  10.             string [] torpe_kezfogo = {"Tudor:Vidor", "Tudor:Hapci", "Szende:Tudor", "Hapci:Vidor", "Kuka:Vidor", "Morgo:Kuka", "Szundi:Tudor"};
  11.            
  12.            
  13.             string [] torpe = new string [torpe_kezfogo.Length*2];
  14.             string [] tp=new string[2];
  15.            
  16.             for (int i = 0; i < torpe_kezfogo.Length; i++) {
  17.                 tp = torpe_kezfogo[i].Split(':');
  18.                 torpe[i*2]=tp[0];
  19.                 torpe[i*2+1]=tp[1];
  20.             }
  21.            
  22.             Array.Sort(torpe);
  23.             int k=0, db;
  24.            
  25.             while (k<torpe.Length) {
  26.                 Console.Write(torpe[k]);
  27.                 db=0;
  28.                 while(k+db<torpe.Length && torpe[k+db]==torpe[k]) db++;
  29.                 Console.WriteLine(": "+db);
  30.                 k=k+db;
  31.             }
  32.            
  33.             Console.Write("Press any key to continue . . . ");
  34.             Console.ReadKey(true);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment