EasyStringsNot started

Conference badge

The registration desk at a small conference prints paper badges. Each badge shows the attendee's name in capital letters on the first line, the organisation they belong to on the second line, and underneath a rule made of = characters that is exactly as long as the longer of those two lines.

Read the name and the organisation and print the badge.

Input

Two lines: the attendee's name (1-40 characters, may contain spaces) and the organisation (1-40 characters, may contain spaces).

Output

Three lines: the name in upper case, the organisation exactly as given, and a line of = characters whose length equals the longer of the first two lines.

Example 1

Input

ada byron
Engine Works

Output

ADA BYRON
Engine Works
============

"Engine Works" has 12 characters, more than the 9 in "ADA BYRON", so the rule is 12 characters long.

Constraints

  • Each line has between 1 and 40 characters
  • Lines contain letters, digits and spaces only

Hints

Hint 1 of 3

name.ToUpper() returns a new string in capitals; it does not change name itself.

Hint 2 of 3

Every string has a Length property. Math.Max(a, b) picks the larger of two numbers.

Hint 3 of 3

new string('=', 12) builds a string of twelve = characters.

Solution

Show a reference solution and explanation
 C# · reference solution
string name = Console.ReadLine()!;
string organisation = Console.ReadLine()!;

string upperName = name.ToUpper();
int width = Math.Max(upperName.Length, organisation.Length);

Console.WriteLine(upperName);
Console.WriteLine(organisation);
Console.WriteLine(new string('=', width));

Why it works

Strings in C# are immutable, so ToUpper() hands back a new string rather than editing the original; storing that result in a variable lets you both print it and measure it. The rule's width is the larger of the two lengths, which Math.Max gives directly, and the string(char, int) constructor repeats one character that many times. Note that upper-casing does not change the length, so measuring either name or upperName gives the same width.

Lesson for this exercise: C# Syntax and Your First Program

Your program
string name = Console.ReadLine()!;
string organisation = Console.ReadLine()!;

// print the badge: upper-case name, organisation, then a rule of = characters
Run is not available for C# in the browser yet. Write your program here, then download it and run it locally with .NET SDK 8.0 against the examples above. The reference solution below was verified the same way.

Tests: 5 cases including the examples. Passing every test marks the exercise solved in this browser.

How this page was checked. Every program on it was run with .NET SDK 8.0 at build time by the publishing checks, and the output shown is what it printed. Running C# inside the browser is not available yet, so the Run button is absent rather than pretending; copy the code and run it with .NET SDK 8.0 locally.