Advertisement
Stan0033

Untitled

Jul 24th, 2021
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace apps
  6. {
  7. class Program
  8. {
  9.  
  10. static int GetInt() { return int.Parse(Console.ReadLine()); }
  11. static string Get() { return Console.ReadLine(); }
  12.  
  13. static void Main()
  14. {
  15.  
  16. int N = GetInt();
  17. List<string> messages = new List<string>();
  18. for (int i =0; i<N; i++)
  19. {
  20. string given = Get();
  21. List<string> Separate = given.Split(' ').ToList();
  22. string name = Separate.Find(n => n.Contains("@") && n.Contains("|")).Replace("@", "").Replace("|","") ;
  23. int age = int.Parse(Separate.Find(n => n.Contains("#") && n.Contains("*")).Replace("#", "").Replace("*","")) ;
  24. messages.Add($"{name} is {age} years old.");
  25. }
  26. Console.WriteLine(string.Join("\n", messages));
  27. }// END MAIN
  28.  
  29. }
  30.  
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement