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.Threading.Tasks;
- namespace _1st_exs
- {
- class Program
- {
- static void Main(string[] args)
- {
- /**
- string character = "duma";
- //int value = (int) character;
- //Console.WriteLine(value);
- char[] split = character.ToCharArray();
- foreach(char letter in split)
- {
- Console.WriteLine(letter);
- }
- */
- bool condition = true;
- int maxValue = 0;
- string maxValueWord = "";
- while (condition)
- {
- int sum = 0;
- string input = Console.ReadLine();
- //Leaving the loop
- if (input == "END OF GAME")
- {
- condition = false;
- break;
- }
- //Splitting the word into chars
- char[] split = input.ToCharArray();
- //Looping threw the whole word
- foreach (char letter in split)
- {
- int value = (int)letter;
- //Big Letter
- if (value >= 65 && value <= 90)
- {
- sum += 15;
- }
- sum += value;
- }
- //Checking if last element is "t" (116)
- if ((int)split[split.Length - 1] == 116)
- {
- sum += 20;
- }
- //Checking for biggest value and word
- if (sum > maxValue)
- {
- maxValue = sum;
- maxValueWord = input;
- }
- else
- {
- sum = 0;
- }
- }
- Console.WriteLine("Winner is word: {0}", maxValueWord);
- Console.WriteLine("Points: {0}", maxValue);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement