Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _03._Word_Game
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- String name = Console.ReadLine();
- int points = 0;
- int maxPoints = int.MinValue;
- String winnerWord = "";
- while (name != "END OF GAME")
- {
- for (int i = 0; i < name.Length; i++)
- {
- points += name[i];
- }
- if (name[0] >= 65 && name[0] <= 90)
- {
- points += 15;
- }
- if (name[name.Length - 1] == 't')
- {
- points += 20;
- }
- if (name.Length >= 10)
- {
- points += 30;
- }
- if (points > maxPoints)
- {
- maxPoints = points;
- winnerWord = name;
- }
- name = Console.ReadLine();
- }
- Console.WriteLine($"Winner is word: {winnerWord}");
- Console.WriteLine($"Points: {maxPoints}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment