Weekend Programming Challenge Issue #19 – Pattern match


Image

Problem:

Make function match() which takes as input input_string and pattern_string, the input strings may contain any ASCII codes

there are two special codes for use in the pattern-string: ?-replaces 1 character and * – replaces any character(s)

The function should print all words from the input-string which match the pattern-string

words can be separated by any of these characters: ‘ ” . , : ;

if the input-string have this content “The big black cat jump over the window”

if pattern-string is “b*” should print
big
black

if pattern-string is “*c*” should print
black
cat

if pattern-string is “?i*” should print
big
window

The rules:

You can code the solution in any programming language during the weekend and have to submit it to info@olimex.com latest on Sunday July 28th.

On Monday we will upload the solutions on GitHub and review https://github.com/OLIMEX/WPC .

You can play with your real name or with nick if you want to be anonymous, we will not disclosure your personal info if you do not want to.

Good Luck and Have fun!

2 Comments (+add yours?)

  1. United
    Jul 27, 2013 @ 12:06:41

    What is the purpose of the pattern-string? As I understand, we just need to print the words that contain a specific character.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: