1
0
codeforces-template/Codeforces.Test/IOTester.cs

29 lines
589 B
C#
Raw Normal View History

2023-08-11 10:09:15 +03:00
namespace Codeforces.Test
2023-08-09 09:42:50 +03:00
{
2023-12-07 21:44:13 +03:00
public class IOTester
2023-08-09 09:42:50 +03:00
{
private static StringReader? stdIn;
private static StringWriter? stdOut;
public static void Start()
{
stdOut = new StringWriter();
Console.SetOut(stdOut);
}
public static void SetInput(params string[] lines)
{
string input = string.Join(Environment.NewLine, lines);
stdIn = new StringReader(input);
Console.SetIn(stdIn);
}
2023-12-07 21:44:13 +03:00
public static IEnumerable<string> GetOutputLines()
2023-08-09 09:42:50 +03:00
{
2023-12-07 21:44:13 +03:00
return stdOut?.ToString()
.Split(Environment.NewLine)
.SkipLast(1)
?? Enumerable.Empty<string>();
2023-08-09 09:42:50 +03:00
}
}
}