We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged


C# .NET, 162 bytes using System;class A{static void Main(string[] s){Console.Write(System.Text.RegularExpressions.Regex.Replace(s[0],String.Format("([{0}]{{1}}).*?\\1",s[1]),""));}} Try it online! Er, the OP's test case is faulty. Either you remove all text between any two symbols, or you remove all text only between like symbols. OP does both in his test ...


Using C (size <12 KiB, time < 0.001s) $ cat >hola.c <<END_C #include<unistd.h> int main(){ int i,n; read(0,&n,1); for(i='0';i<n;++i){ write(1,"Hola mundo.\n",12); } } END_C $ gcc hola.c -o hola $ wc -c hola 11944 hola $ time ./hola <<<5 [...] real 0m0.001s user 0m0.000s sys 0m0.000s


C++11 approach (Time: 3.6 µs on some Intel i7, File size of a.out: 28K) compiled via: clang -O3 -march=native -Ofast golf.cpp: (Clang 6.1) #include <iostream> #include <chrono> #include <sstream> int main(int argc, char** argv) { auto t1 = std::chrono::high_resolution_clock::now(); const int n = 5; if (n < 0 || n > 5) return ...

Top 50 recent answers are included