Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Character_Multiplier
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. string[] input = Console.ReadLine().Split(' ').ToArray();
  11. string w1 = input[0];
  12. string w2 = input[1];
  13.  
  14. int sum = 0;
  15. for (int i = 0; i < Math.Min(w1.Length,w2.Length); i++)
  16. {
  17. sum += w1[i] * w2[i];
  18.  
  19. }
  20. for (int i = Math.Min(w1.Length, w2.Length); i < Math.Max(w1.Length,w2.Length); i++)
  21. {
  22. try
  23. {
  24. sum += w1[i];
  25. }
  26. catch
  27. {
  28. sum += w2[i];
  29. }
  30.  
  31. }
  32. Console.WriteLine(sum);
  33.  
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement