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 _07.Name_Wars
- {
- class Program
- {
- static void Main(string[] args)
- {
- int current = 0;
- int max = 0;
- string namemax = "";
- int max1 = int.MinValue;
- while(true)
- {
- string name = Console.ReadLine();
- if (name == "STOP")
- break;
- for (int i = 0; i < name.Length; i++)
- current = current + name[i];
- if (current > max1 && current>max)
- {
- max = current;
- namemax = name;
- current = 0;
- }
- current = 0;
- }
- Console.WriteLine($"Winner is {namemax} - {max}!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement