Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AnthonyN1974

@AnthonyN1974
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Coding Challenge
    A AnthonyN1974

    I was fed up, so here it is in c#

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace CodeChallenge
    {
    class Program
    {
    private static List<string> wordsToRemove = new List<string>() { "dog", "cat" };

    static void Main(string\[\] args)
    {
      string text = "dog cat monkey dog horse dog";
    
      string\[\] words = text.Split(' ');
      string\[\] output;
      int start = 0;
      int end = 0;
    
      // test the start
      if (wordsToRemove.Contains(words\[0\]) && words.Length > 0)
        start = 1;
    
      // test the end
      if (wordsToRemove.Contains(words\[words.Length - 1\]) && words.Length != start)
        end = (words.Length - 1) - start;
      else
        end = words.Length - start;
    
      //build
      output = new string\[end\];
      Array.Copy(words, start, output, 0, end);
    
      //output
      Console.WriteLine(string.Join(" ",output));
    }
    

    }
    }

    The Lounge c++ architecture help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups