1
0
codeforces-template/Codeforces.Test/IOTester.cs
2023-12-07 21:44:13 +03:00

29 lines
589 B
C#

namespace Codeforces.Test
{
public class IOTester
{
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);
}
public static IEnumerable<string> GetOutputLines()
{
return stdOut?.ToString()
.Split(Environment.NewLine)
.SkipLast(1)
?? Enumerable.Empty<string>();
}
}
}