Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Fixing Broken Lines
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { bool joinLines=false; string lastLine=default(string),line; while((line=Console.ReadLine())!=default(string)){ if(joinLines)lastLine+=line; bool brokenLine=Regex.Replace(line,"[^\"]",string.Empty).Length%2==1; string printLine=default(string); if(brokenLine){ if(joinLines)printLine=lastLine;else lastLine=line; joinLines=!joinLines; }else{ if(joinLines==false)printLine=line; } if(printLine!=default(string))Console.WriteLine(printLine); } } } }
run
|
edit
|
history
|
help
0
asdfsdgghjghkhj
Armstrong
asdfgthyjukjyhtgrfed
Regex - Leading zeros
xddd
General.cs
CultureInfo example
Sealed
C# - String Parsing
Test