Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _05CompareCharArrays
- {
- class Program
- {
- static void Main(string[] args)
- {
- char[] firstArray = Console.ReadLine().Split().Select(char.Parse).ToArray();
- char[] secondArray = Console.ReadLine().Split().Select(char.Parse).ToArray();
- int firstSize = 0;
- int secondSize = 0;
- for (int i = 0; i < firstArray.Length; i++)
- {
- firstSize += firstArray[i];
- }
- for (int i = 0; i < secondArray.Length; i++)
- {
- secondSize += secondArray[i];
- }
- if (firstSize <= secondSize)
- {
- Console.WriteLine(string.Join("", firstArray));
- Console.WriteLine(string.Join("", secondArray));
- }
- else
- {
- Console.WriteLine(string.Join("", secondArray));
- Console.WriteLine(string.Join("", firstArray));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment