Dart, bit longer, but it's fine lol. I still abide by the rule that not everything needs to be creative. Readability is my philosophy. If you can read the code and understand what's happening, the better for everything reading the code. Personally.
voidmain(){vardoc1="TOP SECRET:\nThe missile launch code for Sunday XXXXXXXXXX is:\nXXXXXXXXXXXXXXXXX";vardoc2="TOP SECRET:\nThe missile launch code for Sunday 5th August is:\n7-ZERO-8X-ALPHA-1";print(allegedlySimilar(doc1,doc2));// truedoc1="The name of the mole is Professor XXXXX";doc2="The name of the mole is Professor Dinglemouse";print(allegedlySimilar(doc1,doc2));// falsedoc1="XXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXX\nXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXX XXXXX";doc2="Area-51. Medical Report. 23/Oct/1969\nE.T. subject 4 was given an asprin after reporting sick for duty today";print(allegedlySimilar(doc1,doc2));// true}boolallegedlySimilar(Stringdoc1,Stringdoc2){varredacted=(data){List<String>joined=List<String>();varlines=data.split("\n");for(varlineinlines){vardata=StringBuffer();line.split('').forEach((char)=>data.write('X'));joined.add(data.toString());}returnjoined.join("\n");};returnredacted(doc1)==redacted(doc2);}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Dart, bit longer, but it's fine lol. I still abide by the rule that not everything needs to be creative. Readability is my philosophy. If you can read the code and understand what's happening, the better for everything reading the code. Personally.