Questions tagged [parsing]

This tag denotes challenges where parsing input is a large / the main part of the challenge.

Filter by
Sorted by
Tagged with
36
votes
15answers
3k views

Will I tip over?

Overview Given a 3 line string, figure out if the structure falls to the left, balances, or falls to the right. Input structure You can imagine the structure as metal rod with stuff on top, all ...
7
votes
3answers
321 views

Identify the direction of lines in an ASCII-figure

Challenge: Take a rectangular figure consisting of the two characters # and (whitespace, ASCII-32), and identify which ...
20
votes
22answers
1k views

Simplify matrix input!

I have written a few challenges related to matrices, and common for all are that I use a format like the one below when representing the matrices, both in examples and in test cases: ...
24
votes
10answers
1k views

Convert a TIO answer to a CMC answer

Let's for once do something useful. Given the text from a Try It Online codegolf submission, produce the equivalent Chat Mini Challenge submission, which is of the form ...
18
votes
11answers
1k views

Swep tha vowels!

Note: the title was misspelled intentionally. Given a string s, swap the first vowel runs of every 2 words. For this challenge, y is considered a vowel. For example, given an input of "great day sir"...
6
votes
1answer
1k views

Regular expression parser

This task is a classic programming task: Implement a regular expression parser. That is, write a program or function which takes a string describing a regular expression and a candidate string, and ...
11
votes
1answer
221 views

I <3 conditionals

You end up having a lot of very long, boring-looking conditionals in your code: if flag == 1: while have != needed: if type == 7: These can be transformed into ...
45
votes
13answers
3k views

Golf my Shakespeare quote references

While writing my essay for Shakespeare, I realized that I needed to shorten my quote references to more manageable lengths. I had previously been writing this: ...
37
votes
1answer
1k views

Guess how to pronounce German words

Introduction Unlike English, German is considered to have quite a phonemic writing system. That means that the correspondence between spelling and pronunciation is close. Given any word you aren't ...
8
votes
13answers
1k views

Extract the Coefficients of a Linear Equation

Given a linear equation mx+n, return n and m. However, the equation may be in any of the ...
16
votes
1answer
504 views

What would your reputation be without the rep cap?

In this challenge, you will calculate what your reputation would be, if the reputation cap didn't exist on PPCG. Everyone can access the rawdata for reputation changes on the adress: codegolf....
0
votes
1answer
106 views

Take an input, a formula, and do f(x) [closed]

What I want: Take an input, x Take a formula. It has to be capable of reading something in the format: ax^m + bx^n + cx^o ... where m, n, o and any terms after that can represent any value. ...
21
votes
24answers
1k views

Wherre are the adjacent characters in the title? [3, 4]!

Title misspelled on purpose. Read more to find out why. Your task: given a delimited string or list including the characters A,B,C,D, output the indexes of all the ...
34
votes
8answers
4k views

Read ASCII-Art Text

Inspired by Golf me an ASCII Alphabet, of which this challenge is (almost) a direct inverse. Task: Take a string of ASCII-art text and output the content of the text as regular ASCII text. Input: ...
7
votes
3answers
450 views

Line up for golf!

Alice, Bob, Carol, Dave, and Eve are going out for a nice game of golf and need your help to decide in what order they will play. Your program will input some statements, which are defined as a ...
0
votes
0answers
64 views

Who won the game? [duplicate]

Task Everyone knows the game "Tic-Tac-Toe". Your task is it, to evaluate an ascii tic-tac-toe matchfield. Your Programm/Function should output/return the winner: O, X or nobody (N). Pattern ...
10
votes
8answers
646 views

Grade My Scan-tron!

Standardized testing usually comes with a scan-tron or some type of answer document that records your answer. A computer or human(s) would then check your answers and determine your grade. So here, ...
0
votes
1answer
116 views

CSV cleanup: remove all in col after ( [closed]

Problem Given a file with: ...
23
votes
16answers
1k views

Making Music Boxes

Your task is to take a sequence of characters (the music) as input (in a function or program), and print (or return) the music as it would look like in a music box. You will only receive the ...
14
votes
4answers
496 views

Solve Math Problem Notation

Imagine I have an infinite number of homework problems (!) each given an integer number. Math Problem Notation is a notation for describing subsets of the problem using problem specifiers. An MPN ...
12
votes
18answers
1k views

Simple CSV/DSV importer

Slightly more than an inverse of this. In: Multi-line DSV data and a single delimiter character. The DSV may be taken as a file, a filename, line-break separated string, list of strings, etc. ...
32
votes
1answer
2k views

Generate Pyramid Scheme code

Pyramid Scheme is a language being developed by @ConorO'Brien. In Pyramid Scheme, the code that you write looks like this: ...
7
votes
1answer
358 views

Parse the Markdown-like Markup!

The Challenge In this challenge, you are supposed to write a program or function that takes in a String, which will contain the simplified Markdown-like Markup, and outputs the corresponding HTML ...
28
votes
1answer
433 views

Count spelling errors in text; minimize the number of spelling errors in your code

Write a program or function that takes two inputs: A text message The dictionary of English language, as it appears in this Github file (containing about 60000 words) and outputs the number of ...
14
votes
13answers
2k views

Permanently self-modifying code

Now, we all know most languages have very simple ways to "self-modify" code. However, what if you were to actually modify the code and edit parts of it...on disk? Your goal is to make code that ...
24
votes
2answers
931 views

Write an Incident tokeniser

Background Incident is a fairly unusual programming language, in that its list of tokens is not predetermined, but rather inferred from the input. As such, tokenising an Incident program can be ...
27
votes
39answers
5k views

12 hour to 24 hour time converter

Amazingly, this simple task doesn't seem to exist already, so... Your task is to write a program that takes as input a 12 hour time, and converts it into "military time", or 24-hour time format. ...
19
votes
6answers
679 views

Count the characters - bit by bit!

The simple part: Given an input string containing only printable ASCII-characters (space - tilde), count the number of occurrences of each character and return the result on any convenient format. The ...
2
votes
3answers
225 views

Binary to trinary [duplicate]

The problem Given a binary number from 0 to 111111 convert it to trinary. (Base 3). Then print the result. Rules No using a list of conversions. Don't cheat You must use a string as the number ...
28
votes
19answers
2k views

URL-Friendly Titles

People on this site really love to embellish their post titles... Stewie's sequence: + * - / + * - / However, when this title needs to be included in the page ...
15
votes
19answers
2k views

Shortest Konami Code

The Problem You must write a program that, when the Konami Code is typed in during runtime, prints the string "+30 lives" and sounds a noise of your choice from ...
34
votes
28answers
4k views

Please release me!

As code-golfers, we're not used to releasing (surely). We're gonna need a few tools to help us do that. Of course, to help marketing a new release, we need a nice and shiny Release Version. Who doesn'...
25
votes
15answers
884 views

Transpile WordMath

We've all seen those online "maths hax" that look like this: Think of a number, divide by 2, multiply by 0, add 8. And, by magic, everyone ends up with the ...
5
votes
9answers
921 views

Parse a raw IRC message

In the IRC protocol, raw messages look similar to this: command arg1 arg2 :arg3 with spaces :arg4 with spaces :arg5 In a shell environment (e.g. bash), that ...
13
votes
11answers
342 views

Interpret loose ranges

Interpret loose ranges ListSharp is an interpreted programming language that has many features, one of those features is a 1 index based range creator that works like this: You define a range as <...
18
votes
14answers
1k views

Translate number pairs to guitar notes

A guitar fretboard diagram looks like this: ...
23
votes
20answers
3k views

Jimmy these arrays down

My coworker, Jimmy is kinda new to C/C++. He's also kind of a slow learner. Now, to be fair, his code always compiles, but he has some really sloppy habits. For example, everybody knows that you can ...
9
votes
2answers
405 views

The ten hundred most common words

This question is written because "Thing Explainer" is fun to read, and gave me an idea. Write "stuff that makes computer do things" that reads/takes a set of letters, numbers and things like this <...
26
votes
32answers
4k views

Decode the chmod

Challenge Given a three digit octal permissions number, output the permissions that it grants. chmod On UNIX OSes file permissions are changed using the chmod ...
30
votes
20answers
3k views

Parse the comments out of my esoteric code

Earlier this week, we learned about how to format esoteric languages for commenting. Today, we're going to do the inverse of that. I need you to write a program or function that parses some well-...
11
votes
2answers
355 views

What's on the TV?

Challenge Write a program which, using the XML data from the site here, display the name of the programme which is currently showing on BBC 1. Information All times are given at London time (GMT+1 ...
6
votes
2answers
377 views

Number Plate Golf: Parsing

See Also: Recognition Introduction You've now been taken off the speed camera development team (let's face it, your code is nowhere near production code standards) and are now working on a program ...
18
votes
23answers
3k views

Quick Golf: The Gold Leader

Challenge Using data from the API here, output the names of the three countries with the most Olympic gold medals at the 2016 Rio Olympic Games (i.e. the first element of the returned list). For ...
76
votes
84answers
10k views

Count of “a”s and “b”s must be equal. Did you get it computer?

In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated: mainly because this language ...
9
votes
3answers
300 views

Parse and Process the Key-Language Input

Let's parse and process Key-Language! Given the input of a sequence of keyboard keypresses and/or special keys, write a program, function, etc. that outputs the product when all the actions are ...
18
votes
36answers
2k views

What's the second non-repeating character?

Based on this question from Code Review Given a non-empty string of printable ASCII characters, output the second non-repeating character. For example, for input ...
19
votes
4answers
349 views

Convert an Expression to Panfix Notation

I was browsing esolangs, and chanced upon this language: https://github.com/catseye/Quylthulg. One interesting thing about this language, is that it doesn't use prefix, postfix, or infix, it uses all ...
27
votes
9answers
1k views

Decode a Microsoft MS-DOS 5.0 FAT directory entry

The Microsoft FAT file system has a directory table to represent which "files" are in which "folders" on the disk. For the time, these entries crammed a lot of information into a small amount of bits. ...
17
votes
11answers
744 views

Is my emoji dry?

This is my pet emoji, Billy: -_- Emojis don't like to be in the rain, so Billy is sad... Let's draw him an umbrella to make him feel better! ...
4
votes
5answers
319 views

Is the gas lighter than air?

Air balloons need a gas that is lighter than air. However, hydrogen is flammable, while helium is not sustainable, so we need a replacement! You must write code that determines whether any given gas ...