Questions tagged [string]

A competition to solve a particular problem through the usage and manipulation of strings.

Filter by
Sorted by
Tagged with
42
votes
16answers
8k views

God is real . . . unless declared integer

This challenge is inspired by Fortran's idiosyncratic implicit typing rules. Your task will be to determine the data type of the object GOD according to the ...
24
votes
18answers
3k views

Cook me a character meal

Chef Avillez is about to cook us some really nice meal. He is just waiting for us to give him some ingredients and to request a meal. Task Given a list of ingredients (strings matching ...
19
votes
28answers
2k views

Pendulum Encoding

Given a string as an input (which can be any acceptable/convenient format in your language), implement pendulum encoding. The test cases are split into individual items (which aren't quoted) for a ...
12
votes
9answers
714 views

Simulate D Flip-Flop

Objective Simulate an edge-triggered D Flip-Flop. What is D Flip-Flop? A D flip-flop is an electronic digital device that outputs an inputted data (abbr. D) with synchronization to a clock (abbr. ...
24
votes
37answers
3k views

Vowels up, consonants down

Challenge You will be given a string that can contain lowercase letters, uppercase letters, or spaces. You have to turn the vowels (a, e, i, o, u) in the string to upper case and consonants to lower ...
46
votes
31answers
4k views

Name your novel disease

Introduction The current coronavirus disease is officially named COVID-19, from the 3 words corona virus disease, and the year 2019. (Technically it's coronavirus, making 2 words, but whatever...) ...
17
votes
11answers
674 views

Smaller Strings in Printable ASCII base

Task Given a input string s which contains only printable ascii characters output all strings which contain only printable ascii characters and are strictly ...
15
votes
6answers
708 views

Calculate the average longest common substring exactly

[Question inspired by Can you calculate the average Levenshtein distance exactly? . Thank you Anush. ] The longest common substring between two strings is the longest substring which is common to ...
5
votes
5answers
458 views

Special Character Coding Challenge - Check string for validity (Lots of rules) [closed]

There are 5 different "special characters": % & # $ ! These special characters are in a string with numbers. Like so: "5 ! 60%2$5.3" (valid). You must determine the validity of the string and ...
18
votes
23answers
2k views

The SBEVE Challenge

She said s(he) be(lie)ve(d), he said sbeve. Input A non-empty string, s. It's guaranteed that s will have only printable ASCII ...
-4
votes
13answers
350 views

Convert a string to upper case without using built in methods/functions [closed]

Challenge You will be given a string as an argument. You need to convert that string to upper case. But you can't use any built in method or function nor any external programs. Rule No use of ...
35
votes
18answers
6k views

Bad factorial joke

Sometimes I make bad jokes... And a bad joke I like to make involves interpreting exclamation marks in sentences as the factorial sign. Task Your task is to write a program that receives a sentence ...
29
votes
31answers
6k views

When I grow up I want to be ASCII

Task Your task is to take a character in: AÁÀÃÂBCÇDEÉÊFGHIÍJKLMNOÕÓÔPQRSTUÚVWXYZaáàãâbcçdeéêfghiíjklmnoõóôpqrstuúvwxyz and turn it into a characters in: ...
28
votes
27answers
3k views

(RGS 3/5) Help me write Portuguese!

Context (Feel free to skip, doesn't really matter for the algorithmic explanation of the task) European Portuguese is a fairly complicated language to learn, mostly because of its grammar. One ...
43
votes
153answers
11k views

Scream very loudly

Write a script that outputs A to stdout infinitely. There shold be no newlines or seperators between the characters Standard loopholes apply This is code-golf. ...
21
votes
41answers
2k views

(RGS 2/5) How many strings can you count within these character classes?

Task Given a string composed of ASCII printable characters, return how many strings could fit the given pattern with character literals and regex-like ranges. Pattern string The pattern string ...
7
votes
6answers
312 views

String-wise calculus (i)

This will turn into a series involving other aspects of calculus, including using the "derivative" of a string to find "stationary points" etc, as well as "integration" of sentences Introduction If ...
31
votes
43answers
7k views

Is it really time?

A time in the format hhMMss is represented by six numbers in the range 0..9 (e.g.100203 for 3 seconds after 2 minutes after 10am (10:02.03), or ...
8
votes
19answers
914 views

Put in the quotes

Background There's a terrible problem in my console - the quotes never get included inside the arguments! So, when given this argument: ["abc","def","ghi","jkl"] ...
4
votes
12answers
460 views

Creating words by structure

Context As a conlanger, I am interested in creating a uniform, naturalistic language. One of the tricks is to create vocabulary according to certain structures of words. An example from English: In ...
18
votes
14answers
3k views

Visualize a Recursive Acronym

Background Famously, the acronym GNU stands for GNU's Not Unix. 1 It's recursive because, after expanding it once, it still ...
24
votes
21answers
4k views

The most common substring

The purpose of this task is to write a program or function to find the most common substring within a given string, of the specified length. Inputs A string, s, of ...
3
votes
7answers
234 views

String permutations

Print the biggest-size subset of strings in the input that are all permutations of each other. If there are ties, any one will do. If no strings are permutations of each other (for example, only one ...
22
votes
17answers
2k views

Answer templating

Context Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. ...
2
votes
0answers
163 views

Predictor Generator [closed]

Write a program that when given a string \$S\$, it generates a program of the same language as itself. The generated program, when given a continuous substring of \$S\$, should predict the next ...
5
votes
5answers
345 views

Find the most important character

Find the most important character The challenge is to write a program that outputs the most occurrent character in the input string, excluding these bracketing characters ...
1
vote
1answer
205 views

Name an arbitrary string [closed]

This should be easy: given an arbitrary string, your program will give it a name. Requirements Your program will accept an input of a UTF8 string, and output a string representing the input's "name",...
3
votes
5answers
327 views

Implement a Caesar Cipher with a Digit Shift

I assume everyone here is familiar with the Caesar Cipher that shifts letters to a certain index. https://en.wikipedia.org/wiki/Caesar_cipher for those who still needs introduction. But, we can all ...
28
votes
25answers
2k views

The Magical Piper

An old test for programmers, taken from here (Note: in italian). Along a road (denoted by '_'), there is a Magical Piper (denoted by '...
31
votes
20answers
4k views

Print this maximally long URL

Task This one is simple. We want to compress a URL, but don't trust URL shorteners. Write a program that prints to stdout (or a 0-argument function that returns) the following, working URL: http://...
4
votes
3answers
202 views

Shortest POSIX command line that eagerly removes dual newline sequences

Example: echo -ne 'a\n\nb\nc\n\n\n\nd\n\n\n' | your-command should output the same as echo -ne 'ab\ncd\n' Watch out, some ...
16
votes
28answers
2k views

pleTriwapt Sgpin (Triplet Swapping)

Intro/Background I was looking at a Flybuys card at Coles recently and noticed that if I took something like this: Source, randomly found on the Internet And swapped some words around, I'd get ...
28
votes
69answers
5k views

Repeat every other character in string starting with second character

Requirements: Take a single word as input with only lowercase alphabetical characters (a-z) Output a string where every other character is repeated, with the first repeated character being the second ...
12
votes
1answer
482 views

Write a Whitespace Interpreter

Challenge: Your challenge is to write an interpreter for Whitespace. Given a string consisting of spaces, tabs, newlines, and potential other characters, as well as possible inputs for the Whitespace ...
44
votes
11answers
4k views

Simple Circular Words

A "simple circular" word is a word whose chords do not intersect. The chords of a word may be seen by laying out the alphabet in a circle, and then connecting the word's consecutive letters. ...
22
votes
11answers
2k views

Narcissistic Quine [duplicate]

Write a program/method that: Becomes a quine when the input matches the source code; Doesn't halt otherwise. This is code-golf, so shortest solution wins. Avoid any standard loopholes.
20
votes
19answers
2k views

Super permutations

Super permutations Input: A string The program should loop through all lengths of the input (decrementing one each time), generate all combinations with replacement of the string, then make ...
14
votes
1answer
590 views

Is everything in order?

Challenge: Input: a string, consisting of only printable ASCII characters Output: a truthy/falsey value whether its characters are in alphabetical order (based on their UTF-8 unicode values), from any ...
14
votes
4answers
587 views

Keta Bracket Autocompletion

Special thanks to Bubbler and AdmBorkBork for supplying feedback about this challenge Keta (Keyboard tacit — clever naming, I know!) is a golfing language I’ve been working on recently. One of it’s ...
7
votes
1answer
557 views

Average number of strings with Levenshtein distance up to 4

This is a version of this question which should not have such a straightforward solution and so should be more of an interesting coding challenge. It seems, for example, very likely there is no easy ...
4
votes
4answers
268 views

Partial tq interpreter

In this task you are expected to provide a list output given an input tq program. The tq programs will not contain whitespace inside them. What is tq, in the first place? tq is a lazy-evaluated ...
-2
votes
2answers
276 views

Shorten String as Much as Possible [closed]

Introduction In a list of strings, there is a certain length you can shorten strings to before they become indistinguishable. This is a pretty bad explanation, so here is an example. ...
13
votes
4answers
2k views

Can you calculate the average Levenshtein distance exactly?

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. The challenge is to compute ...
6
votes
1answer
671 views

Average number of strings with Levenshtein distance up to 3

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. Given a binary string \$S\$ of ...
34
votes
39answers
3k views

CahartcreS awppnig (Character Swapping)

Intro/Background I was looking at "You Had One Job" pictures lately, and noticed an old favourite of mine: And I said to myself: "I need a program that can generate text like that". So I devised a ...
9
votes
11answers
1k views

Reversing and Shifting

Sandbox Adapted from exercise 8 of 100 little Keg exercises String manipulation is a very important part of any programming language. Consequently, that is what this challenge is about. The ...
9
votes
11answers
576 views

Convert Character Substrings to Numeric

I often have to take character data and categorize it numerically at work. A common thing I do is to take character type variables and convert them to numeric type characters, keeping same categories ...
5
votes
11answers
867 views

Even-Odd chunks

(Inspired by the Keg utility of this challenge) Given a non-empty input string, e.g. s c 1= e(a"E"), split the input into even-odd chunks. Example (Feel free to ...
19
votes
10answers
1k views

Fill the Golfeek gutter

Golfeek is the working name of an esolang I'm occasionally working on. One distinctive feature of this language is that each statement is encoded as a sequence of bits rather than a sequence of bytes. ...
21
votes
4answers
474 views

Hexagonify™ a String Block

Sandbox What is Hexagonification™? Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then ...

1
3 4
5
6 7
39