Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [string]

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

0
votes
0answers
2 views

I am getting an error in string operation. Please help

s=s+arr[i]; Here s is string and arr is int. s+=arr[i]; why the first statement is invalid but the second statement is valid?
6
votes
3answers
153 views

Is it Valid Modified UTF-8?

UTF-8 is a relatively simple way to encode Unicode codepoints in a variable-width format such that it doesn't easily confuse code that isn't Unicode aware. UTF-8 overview Bytes in the range of 0-...
-3
votes
0answers
77 views

Split Longer Message to multiple short messages [duplicate]

Post short messages limited to 50 Example "I can't believe Tweeter now supports chunking my messages, so I don't have to do it myself." This is 91 ...
6
votes
11answers
384 views

Mis-decode a date

Background Inspired by a now deleted question by John Burger from which I quote: Now obviously no human made this mistake. It's a mis-decode of something - perhaps the ISBN? My question is: ...
5
votes
0answers
118 views

Pattern Finder - Find Repeated Pattern in String [closed]

Introduction This is a little challenge with the goal of identifying repeated pattern "blocks" in a string, and outputting them with their frequency of occurence from left to right. A friend asked ...
14
votes
13answers
514 views

Write a function/method that takes in a string and spells that word out using the NATO Phonetic Alphabet. Titlecase optional

Write a program that takes in a string and spells that word out using the NATO Phonetic Alphabet. The mapping is as follows: ...
12
votes
14answers
1k views

Clock (transliterate) Cipher

Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too ...
57
votes
42answers
10k views

Oreoorererereoo

Oreoorererereoo Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability). Rules The ...
0
votes
1answer
75 views

Remove indentation [duplicate]

Write a program which removes any common leading spaces from the input string. For example, if the least indented line started with 3 spaces, and every other line has ...
4
votes
6answers
409 views

Corrupting A Binary File By Interpreting It As Text

Using FTP's ASCII mode to transfer binary files is a bad idea. It is likely to corrupt your data. Badly. Let's simulate this corruption! Your task is to write a program which takes a file as input ...
49
votes
30answers
5k views

Encode the date in Christmas Eve format

The day this post was published was Christmas Eve. Tomorrow will be Christmas. Yesterday was Christmas Eve Eve. In two days it will be ...
42
votes
23answers
2k views

Parse the Bookworm dictionary format

I've recently been indulging myself in some nostalgia in the form of Bookworm Deluxe: In case you haven't seen it before, it's a word game where the goal is to connect adjacent tiles to form words. ...
18
votes
13answers
1k views

Trifid Cipher (without keyword)

Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too ...
20
votes
45answers
2k views

String rotation - output string repeatedly moving first character to the end

The challenge here is to take a string and output all its rotations, by repeatedly moving the first character to the end, once per character in the string, ending with the original string: ...
19
votes
8answers
531 views

Doubled-letter steganography

Steganography hides a given message inside a given carrier, producing a package that does not look suspicious. For this challenge, you will write a program that takes an ASCII message and an ASCII ...
1
vote
0answers
53 views

Bracket checking [duplicate]

Consider a string like: a.push(c.push("a",["ad","bd",2,{"ard",duo}]).pop().replace(2,"tg").enc([3,{2,adf},"atr"],5) Write a program that will verify whether a ...
10
votes
11answers
488 views

Map the cheaters!

After all assignments are submitted, a dictionary is created that maps student number to the hash of their file. This dictionary, or hashmap, or mapping (whatever your language calls it) will look as ...
3
votes
2answers
209 views

Algorithm to print the Minimum number of adjacent character swaps necessary to remove all instances of “VK” in a given string?

For example, how many adjacent swaps are at least needed to convert some string such as BVVKCV to one without any instances of VK...
2
votes
0answers
125 views

Find what a phrase with removed letters originally said in fewest characters [closed]

Write a program that, given a string of capital letters, output all possible phrases that could have been written originally, using any variant of the Oxford English Dictionary. Input There are two ...
14
votes
12answers
2k views

Computer Cipher

Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too ...
21
votes
28answers
2k views

Make a simple word wrapper

(Note: This is my first ever code golf question, but as far as I can tell, nobody else has done exactly this, so I should be good.) Your task is to make a program or function that takes in a string <...
13
votes
5answers
252 views

Conjugation in Real Life

In @Adám's Dyalog APL Extended, the (under) operator means conjugation: apply one function, then a second function, then the inverse of the first. It's fun to ...
21
votes
17answers
2k views

Split Mark's marks

Challenge Mark is a student who receives his N marks in a concatenated way in a one single line. The challenge is to separate his marks, knowing that each mark ...
15
votes
7answers
848 views

Lazy word problems

Summary A teacher was told to prepare word problems for the students. She is given a list of equations and told to write them as the corresponding word problem. However, she is very lazy, so she ...
24
votes
14answers
3k views

How frustrating is my movie?

My parents have an home theater device. The remote is broken making it incredibly difficult to navigate rightwards in a menu. Most the time it doesn't work but when it does it moves rightwards ...
12
votes
3answers
257 views

Unminify a Pythlike String

Pyth is perhaps the most successful general-purpose golfing language. Though it is somewhat in decline as a result of newer languages, from 2014 to 2016 Pyth's concise syntax, constant updates, ...
15
votes
30answers
2k views

Upward and onward to greater glory!

May this challenge serve as (another) tribute to Stan Lee, who passed away aged 95. Stan Lee has left us an invaluable legacy and a peculiar catch word: Excelsior. So here's a small challenge based ...
8
votes
2answers
170 views

Should this identifier be suggested?

Introduction In Android Studio and other IDEs there are code completions to assist efficient code insertion (especially when the names of the classes or methods are so verbose), like the one in the ...
-2
votes
3answers
121 views

Doce logf a string swapper [closed]

Challenge Take an input string \$s\$, and split it into words \$w_1, w_2, ..., w_n\$. If the amount of words is odd, then return \$s\$. Otherwise, for each word: Take the second last letter, and swap ...
19
votes
32answers
3k views

How fast am I vrooooming?

Introduction My car speedometer was hacked! Instead of showing me how fast i'm driving, it just shows: "Vroooom!" Please help me know how fast i'm going. Challenge Take a string as input, and check ...
1
vote
5answers
573 views

0xDEADBEEF is not tasty, but still 0xFEEDBEEF

Inspired by "You had me at hello" Introduction For those who don't know, hexadecimal is a base system like decimal. Contrary to decimal however, it uses 16 (hence the name) digits instead of 10. ...
1
vote
0answers
107 views

x bottles of y on the z [duplicate]

I do not believe this question to be a duplicate of this one, since this one requires more string manipulation, if it is still a duplicate feel free to close this question Introduction Your ...
11
votes
12answers
2k views

Split it. But not all!

Inspired by this StackOverflow question. Input: We'll take three inputs: A delimiter-character D to split on A character I ...
10
votes
15answers
1k views

Find a recursive acronym

Introduction A recursive acronym is an acronym that contains or refers to itself, for example: Fish could be a recursive acronym for ...
-4
votes
20answers
380 views

Array indexes to number and number reversed

Given an input array having minimum length 2 and maximum length 9 having any initial values output an array having length ...
20
votes
23answers
3k views

Playing with the musical turtle

My two kids like to play with the following toy: The colored areas with the shapes inside can be touched and the turtle then lights the area and plays a sound or says the name of the color or the ...
-2
votes
4answers
211 views

Find the closest RGB color [closed]

Input: A valid 6 HEX digit color code wihout a # prefix Valid: 000000 FF00FF ABC123 Your job is to find to which one of these: ...
20
votes
36answers
8k views

IP address or not?

Your network scanning tool is annoyingly picky about input, and immediately crashes if you feed it an IPv4 address that contains improper characters or isn't properly formatted. An IPv4 address is ...
9
votes
25answers
2k views

Let's play tennis 2: east-west game

There is a challenge Let's play tennis by Daniel. He proposes to place a court in the North-South direction. My proposal is to create a court to play tennis in the East-West direction too. You ...
6
votes
48answers
2k views

String analyser

Use any programming language to display "AWSALILAND" in such a way, so that each letter is in a new line and repeated as many times as its position in the English alphabet. For example letter, (A) ...
6
votes
5answers
276 views

Japanese pitch accent numbers

Your challenge is to turn a Japanese word and a dictionary pitch accent number into a new string where the rises and falls in pitch are marked: e.g. (2, ウシロ) → ウ/シ\ロ...
23
votes
26answers
3k views

Print a Wavy String Line-by-Line

Challenge Write a program or function that takes in a string s and integer n as parameters. Your program should print (or ...
18
votes
34answers
2k views

Text compression

With the given text below, there are some words in the text that repeats several times in the text. Use any programming language to write a short code that compresses the text to display it. Or in ...
2
votes
11answers
371 views

Cycle my input please [duplicate]

Input A string s of printable ASCII characters, newlines, and spaces (0x20 ( ) to 0x7E (~)),...
1
vote
2answers
144 views

Accordion Solitaire: Which First Moves Can I Make?

Introduction: Unfortunately an Accordion Solitaire Solver challenge already exists (Solve a game of Accordion), so instead this easier related challenge. Let's start by explaining how Accordion ...
33
votes
25answers
5k views

Can the number be split into powers of 2?

Yesterday while playing with my kid I noticed the number in his toy train: So we have $$4281$$ that can be split into $$4-2-8-1$$ or $$2^2-2^1-2^3-2^0$$ So simple challenge: given a non-negative ...
20
votes
15answers
5k views

One line Keyboard

The Challenge The goal of this challenge is to determine whether a given String can be typed using only one line of a standard UK QWERTY keyboard. This is ...
18
votes
8answers
3k views

Ternary-if Converter

In Java/.NET/C/JavaScript/etc. you can use ternary-ifs to shorten if-statements. For example (in Java): ...
33
votes
37answers
5k views

Be there, for the square [duplicate]

Sometimes when you're lying in bed and reading a message, your phone screen will pop into landscape mode right in the middle of a sentence. Only being able to read left to right, you find yourself ...
17
votes
4answers
595 views

You are given a string to make and starting with the empty string, make it using appending and cloning cost

Your task is to create the given target string. Starting with an string that is empty, you will have to add characters to it, until your string is the same as the one we want. You can either add a ...