Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Extract_Person_Info_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int lines = int.Parse(Console.ReadLine());
- for (int i = 0; i < lines; i++)
- {
- string[] text = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
- string name = string.Empty;
- string age = string.Empty;
- foreach (var word in text)
- {
- if (word.StartsWith('@'))
- {
- name = word.Substring(1, word.Length - 2);
- }
- else if (word.StartsWith('#'))
- {
- age = word.Substring(1, word.Length - 2);
- }
- }
- Console.WriteLine($"{name} is {age} years old.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement