Pietras286

StringMerge

Dec 13th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. public class Test
  2. {
  3.     unsafe class Program
  4.     {
  5.        public static void Main(string[] args)
  6.         {
  7.             int t = int.Parse(Console.ReadLine());
  8.             for (int i = 0; i < t; i++)
  9.             {
  10.                 string[] tekst = Console.ReadLine().Split(' ');
  11.                 fixed (char* a = tekst[0])
  12.                 fixed (char* b = tekst[1])
  13.  
  14.                 Console.WriteLine(Polacz(a, b));
  15.             }
  16.         }
  17.  
  18.         unsafe private static string Polacz(char* a, char* b )
  19.         {
  20.             string wynik = "";
  21.             while (*a != 0 && *b != 0)
  22.             {
  23.                 wynik += *a;
  24.                 wynik += *b;
  25.                 a++;
  26.                 b++;
  27.             }
  28.             return wynik;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment