desislava_topuzakova

03. Word Game

Apr 9th, 2022
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _03._Word_Game
  5. {
  6. internal class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. String name = Console.ReadLine();
  11. int points = 0;
  12. int maxPoints = int.MinValue;
  13. String winnerWord = "";
  14. while (name != "END OF GAME")
  15. {
  16. for (int i = 0; i < name.Length; i++)
  17. {
  18. points += name[i];
  19. }
  20. if (name[0] >= 65 && name[0] <= 90)
  21. {
  22. points += 15;
  23. }
  24. if (name[name.Length - 1] == 't')
  25. {
  26.  
  27. points += 20;
  28. }
  29. if (name.Length >= 10)
  30. {
  31. points += 30;
  32. }
  33.  
  34. if (points > maxPoints)
  35. {
  36. maxPoints = points;
  37. winnerWord = name;
  38. }
  39.  
  40.  
  41. name = Console.ReadLine();
  42. }
  43.  
  44. Console.WriteLine($"Winner is word: {winnerWord}");
  45. Console.WriteLine($"Points: {maxPoints}");
  46. }
  47. }
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment