Text compression
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
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 other words, use the smallest number of bytes to display the text.
The Text is:
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?
code-golf string kolmogorov-complexity
add a comment |Â
up vote
1
down vote
favorite
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 other words, use the smallest number of bytes to display the text.
The Text is:
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?
code-golf string kolmogorov-complexity
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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 other words, use the smallest number of bytes to display the text.
The Text is:
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?
code-golf string kolmogorov-complexity
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 other words, use the smallest number of bytes to display the text.
The Text is:
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?
code-golf string kolmogorov-complexity
code-golf string kolmogorov-complexity
edited 1 hour ago
Mr. Xcoder
30.9k758195
30.9k758195
asked 2 hours ago
Monolica
15719
15719
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
2
down vote
Bubblegum, 73 bytes
00000000: 0b48 2d49 2d52 08c8 2c00 9205 99c9 d9a9 .H-I-R..,.......
00000010: 290a 890a 05a9 c9d9 0af9 6960 811c a048 ).........i`...H
00000020: 416a 0150 be58 8fcb 1197 9442 0086 397a Aj.P.X.....B..9z
00000030: 5c9e 6958 8471 1baf c315 9e91 5a94 aa5e .iX.q......Z..^
00000040: ac50 9291 4a82 45f6 00 .P..J.E..
Try it online!
add a comment |Â
up vote
2
down vote
JavaScript (SpiderMonkey), 117 bytes
print(`$S='Peter Piper picked' a$O=' peck of pickled peppers'.
A$O $S.
If $S a$O,
Where's the$O $S?`)
Try it online!
I would claim this answer is from ovs, anyway, 19 bytes saved.
1
117 bytes
â ovs
1 hour ago
114 bytes.
â Arnauld
29 mins ago
add a comment |Â
up vote
0
down vote
R, 106 bytes
"["=gsub
cat(1["Peter Piper picked",2[" peck of pickled peppers","1 a2.
A2 1.
If 1 a2,
Where's the2 1?"]])
Try it online!
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Bubblegum, 73 bytes
00000000: 0b48 2d49 2d52 08c8 2c00 9205 99c9 d9a9 .H-I-R..,.......
00000010: 290a 890a 05a9 c9d9 0af9 6960 811c a048 ).........i`...H
00000020: 416a 0150 be58 8fcb 1197 9442 0086 397a Aj.P.X.....B..9z
00000030: 5c9e 6958 8471 1baf c315 9e91 5a94 aa5e .iX.q......Z..^
00000040: ac50 9291 4a82 45f6 00 .P..J.E..
Try it online!
add a comment |Â
up vote
2
down vote
Bubblegum, 73 bytes
00000000: 0b48 2d49 2d52 08c8 2c00 9205 99c9 d9a9 .H-I-R..,.......
00000010: 290a 890a 05a9 c9d9 0af9 6960 811c a048 ).........i`...H
00000020: 416a 0150 be58 8fcb 1197 9442 0086 397a Aj.P.X.....B..9z
00000030: 5c9e 6958 8471 1baf c315 9e91 5a94 aa5e .iX.q......Z..^
00000040: ac50 9291 4a82 45f6 00 .P..J.E..
Try it online!
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Bubblegum, 73 bytes
00000000: 0b48 2d49 2d52 08c8 2c00 9205 99c9 d9a9 .H-I-R..,.......
00000010: 290a 890a 05a9 c9d9 0af9 6960 811c a048 ).........i`...H
00000020: 416a 0150 be58 8fcb 1197 9442 0086 397a Aj.P.X.....B..9z
00000030: 5c9e 6958 8471 1baf c315 9e91 5a94 aa5e .iX.q......Z..^
00000040: ac50 9291 4a82 45f6 00 .P..J.E..
Try it online!
Bubblegum, 73 bytes
00000000: 0b48 2d49 2d52 08c8 2c00 9205 99c9 d9a9 .H-I-R..,.......
00000010: 290a 890a 05a9 c9d9 0af9 6960 811c a048 ).........i`...H
00000020: 416a 0150 be58 8fcb 1197 9442 0086 397a Aj.P.X.....B..9z
00000030: 5c9e 6958 8471 1baf c315 9e91 5a94 aa5e .iX.q......Z..^
00000040: ac50 9291 4a82 45f6 00 .P..J.E..
Try it online!
answered 1 hour ago
ovs
17.7k21058
17.7k21058
add a comment |Â
add a comment |Â
up vote
2
down vote
JavaScript (SpiderMonkey), 117 bytes
print(`$S='Peter Piper picked' a$O=' peck of pickled peppers'.
A$O $S.
If $S a$O,
Where's the$O $S?`)
Try it online!
I would claim this answer is from ovs, anyway, 19 bytes saved.
1
117 bytes
â ovs
1 hour ago
114 bytes.
â Arnauld
29 mins ago
add a comment |Â
up vote
2
down vote
JavaScript (SpiderMonkey), 117 bytes
print(`$S='Peter Piper picked' a$O=' peck of pickled peppers'.
A$O $S.
If $S a$O,
Where's the$O $S?`)
Try it online!
I would claim this answer is from ovs, anyway, 19 bytes saved.
1
117 bytes
â ovs
1 hour ago
114 bytes.
â Arnauld
29 mins ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
JavaScript (SpiderMonkey), 117 bytes
print(`$S='Peter Piper picked' a$O=' peck of pickled peppers'.
A$O $S.
If $S a$O,
Where's the$O $S?`)
Try it online!
I would claim this answer is from ovs, anyway, 19 bytes saved.
JavaScript (SpiderMonkey), 117 bytes
print(`$S='Peter Piper picked' a$O=' peck of pickled peppers'.
A$O $S.
If $S a$O,
Where's the$O $S?`)
Try it online!
I would claim this answer is from ovs, anyway, 19 bytes saved.
edited 1 hour ago
answered 1 hour ago
tsh
7,55611343
7,55611343
1
117 bytes
â ovs
1 hour ago
114 bytes.
â Arnauld
29 mins ago
add a comment |Â
1
117 bytes
â ovs
1 hour ago
114 bytes.
â Arnauld
29 mins ago
1
1
117 bytes
â ovs
1 hour ago
117 bytes
â ovs
1 hour ago
114 bytes.
â Arnauld
29 mins ago
114 bytes.
â Arnauld
29 mins ago
add a comment |Â
up vote
0
down vote
R, 106 bytes
"["=gsub
cat(1["Peter Piper picked",2[" peck of pickled peppers","1 a2.
A2 1.
If 1 a2,
Where's the2 1?"]])
Try it online!
add a comment |Â
up vote
0
down vote
R, 106 bytes
"["=gsub
cat(1["Peter Piper picked",2[" peck of pickled peppers","1 a2.
A2 1.
If 1 a2,
Where's the2 1?"]])
Try it online!
add a comment |Â
up vote
0
down vote
up vote
0
down vote
R, 106 bytes
"["=gsub
cat(1["Peter Piper picked",2[" peck of pickled peppers","1 a2.
A2 1.
If 1 a2,
Where's the2 1?"]])
Try it online!
R, 106 bytes
"["=gsub
cat(1["Peter Piper picked",2[" peck of pickled peppers","1 a2.
A2 1.
If 1 a2,
Where's the2 1?"]])
Try it online!
answered 54 mins ago
J.Doe
1,381111
1,381111
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f173965%2ftext-compression%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password