Advertisement
athsX

04. Character Multiplier

Jun 19th, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Numerics;
  6.  
  7. namespace _04_Exc_CharacterMultiplier
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<string> input = Console.ReadLine().Split().ToList();
  14.             List<char> str1 = input[0].ToList();
  15.             List<char> str2 = input[1].ToList();
  16.             int sum = 0;
  17.  
  18.             if (str1.Count < str2.Count)
  19.             {
  20.                 int count = str2.Count - str1.Count;
  21.                 for (int i = 0; i < count; i++)
  22.                 {
  23.                     str1.Add((char)1);
  24.                 }
  25.             }
  26.             if (str1.Count > str2.Count)
  27.             {
  28.                 var count = str1.Count - str2.Count;
  29.                 for (int i = 0; i < count ; i++)
  30.                 {
  31.                     str2.Add((char)1);
  32.                 }
  33.             }
  34.  
  35.             for (int i = 0; i < str2.Count; i++)
  36.             {
  37.                 var variable = str1[i];
  38.                 sum += str1[i] * str2[i];
  39.             }
  40.  
  41.             Console.WriteLine(sum);
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement