Advertisement
Yanislav29

Untitled

Nov 28th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace ConsoleApp6
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int ticketsCount = int.Parse(Console.ReadLine());
  11. for(int i = 0;i < ticketsCount; i++)
  12. {
  13.  
  14. string ticket = Console.ReadLine();
  15.  
  16.  
  17. char one = ticket[0];
  18. char two = ticket[1];
  19. char three = ticket[2];
  20. char four = ticket[3];
  21. bool conditon = one >= 'A' && one <= 'Z';
  22. if (ticket.Length == 4) {
  23. if (conditon)
  24. {
  25.  
  26. Console.WriteLine($"Seat decoded: {one}{two}{three}");
  27. }
  28. else
  29. {
  30. Console.WriteLine($"Seat decoded: {four}{two}{three}");
  31. }
  32. }
  33. else if (ticket.Length == 5 || ticket.Length == 6)
  34. {
  35. var asciidigit = (int)two;
  36. Console.WriteLine($"Seat decoded: {one}{asciidigit}");
  37. }
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement