Beta
[BF] Character grouping
Description:
Background
Many programming languages offer built-in functionalities to group side-by-side identical elements. For example:
- Python:
groupby
function in theitertools
module - Haskell:
group
/groupBy
function in theData.List
module - Ruby:
chunk
method
So let's make one in BF!
Task
Given a null-terminated string as input, your BF program should output a string where adjacent identical characters are grouped together and enclosed in parentheses.
For the empty input ""
, your program should return an empty string ""
since there is nothing to group.
Examples
Input | Output
----------------- | --------------------
"aaabbbccc\0" --> "(aaa)(bbb)(ccc)"
"112211\0" --> "(11)(22)(11)"
"xyz\0" --> "(x)(y)(z)"
"\0" --> ""
GLHF 😉
Algorithms
Similar Kata:
Stats:
Created | Mar 1, 2024 |
Published | Mar 4, 2024 |
Warriors Trained | 10 |
Total Skips | 0 |
Total Code Submissions | 16 |
Total Times Completed | 7 |
BF Completions | 7 |
Total Stars | 0 |
% of votes with a positive feedback rating | 100% of 4 |
Total "Very Satisfied" Votes | 4 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 4 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |