Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text;
- namespace CharacterMultiplier
- {
- class Program
- {
- static void Main()
- {
- Console.WriteLine(CharMultiplier(Console.ReadLine()));
- }
- static int CharMultiplier(string text)
- {
- var words = text.Split().OrderBy(x => x.Length).ToList();
- var firstWord = Encoding.ASCII.GetBytes(words[0]).ToList();
- var secondWord = Encoding.ASCII.GetBytes(words[1]).ToList();
- int result = 0;
- for (int i = 0; i < secondWord.Count(); i++)
- {
- result += secondWord[i] * (i < firstWord.Count ? firstWord[i] : 1);
- }
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement