Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace TheMostPowerfulWord
- {
- class Program
- {
- static void Main(string[] args)
- {
- string currentWord = Console.ReadLine();
- int lengthOfTheMostPowerfulWord = int.MinValue;
- string theMostPowerfulWord = "";
- while (currentWord != "End of words")
- {
- int sumOfAllLetters = 0;
- for (int i = 0; i < currentWord.Length; i++)
- {
- sumOfAllLetters += currentWord[i];
- }
- if (currentWord[0] == 'A' || currentWord[0] == 'a' || currentWord[0] == 'E' || currentWord[0] == 'e' || currentWord[0] == 'I' || currentWord[0] == 'i' || currentWord[0] == 'O' && currentWord[0] == 'o' || currentWord[0] == 'U' || currentWord[0] == 'u' || currentWord[0] == 'Y' || currentWord[0] == 'y')
- {
- sumOfAllLetters *= currentWord.Length;
- }
- else
- {
- sumOfAllLetters /= currentWord.Length;
- Math.Floor((double)sumOfAllLetters);
- }
- if (sumOfAllLetters > lengthOfTheMostPowerfulWord)
- {
- theMostPowerfulWord = currentWord;
- lengthOfTheMostPowerfulWord = sumOfAllLetters;
- }
- currentWord = Console.ReadLine();
- }
- Console.WriteLine($"The most powerful word is {theMostPowerfulWord} - {lengthOfTheMostPowerfulWord}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement