fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. string[,] table3x3 = new string[3, 3];
  8. string myString = "11A23A4A5A87A5";
  9.  
  10. int stringIndex = -1;
  11. bool immediatelyFollowsA = false;
  12. for (int row = 0; row < 3; row++)
  13. for (int col = 0; col < 3; col++)
  14. {
  15. while (myString[++stringIndex] == 'A')
  16. {
  17. immediatelyFollowsA = true;
  18. }
  19. if (immediatelyFollowsA)
  20. {
  21. table3x3[row,col] = myString[stringIndex].ToString();
  22. immediatelyFollowsA = false;
  23. }
  24. }
  25.  
  26. for (int row = 0; row < 3; row ++)
  27. {
  28. for (int col = 0; col < 3; col++)
  29. if (string.IsNullOrEmpty(table3x3[row,col]))
  30. Console.Write("[ ]");
  31. else
  32. Console.Write("["+table3x3[row,col]+"]");
  33. Console.WriteLine();
  34. }
  35. }
  36. }
Success #stdin #stdout 0.03s 36912KB
stdin
Standard input is empty
stdout
[ ][ ][2]
[ ][4][5]
[8][ ][5]