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.RegularExpressions;
- using System.Text;
- public class Program
- {
- public static void Main()
- {
- string[] input = Console.ReadLine().Split(new [] {' ','\t'},StringSplitOptions.RemoveEmptyEntries);
- decimal result =0;
- foreach (string entry in input)
- {
- char firstLetter = entry[0];
- char lastLetter = entry[entry.Length-1];
- int len = entry.Length-2;
- string numAsString = entry.Substring(1,len);
- decimal num = decimal.Parse(numAsString);
- if (char.IsUpper(firstLetter))
- {
- int position = (int) firstLetter - 64;
- result += num / position;
- }
- else if (char.IsLower(firstLetter))
- {
- int position = (int) firstLetter - 96;
- result += num*position;
- }
- if (char.IsUpper(lastLetter))
- {
- int position = (int) lastLetter -64;
- result -= position;
- }
- else if (char.IsLower(lastLetter))
- {
- int position = (int) lastLetter-96;
- result += position;
- }
- }
- Console.WriteLine("{0:f2}",result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement