Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Numerics;
- using System.Globalization;
- using System.Net;
- namespace ConsoleApplication3
- {
- class Program
- {
- static double Sum(string n)
- {
- var alphabet = new List<char>{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
- 'v', 'w', 'x', 'y', 'z'};
- char first = n.ToCharArray()[0];
- char second = n.ToCharArray()[n.Length - 1];
- double num = double.Parse(n.Substring(1, n.Length - 2));
- if (char.IsUpper(first))
- num = num / (alphabet.IndexOf(char.ToLower(first)) + 1);
- else
- num = num * (alphabet.IndexOf(first) + 1);
- if(char.IsUpper(second))
- num = num - (alphabet.IndexOf(char.ToLower(second)) + 1);
- else
- num = num + (alphabet.IndexOf(second) + 1);
- return num;
- }
- static void Main(string[] args)
- {
- string[] input = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries).ToArray();
- double result = 0;
- foreach (string i in input)
- {
- result += Sum(i);
- }
- Console.WriteLine("{0:F2}", result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement