6 kyu
Typing series #3 --> copy and paste
Description:
You are given a string
of lowercase letters and spaces that you need to type out. You may notice some square brackets inside the string.
- If it contains letters, type out the text inside then copy it.
- If it is empty, paste the copied text
- If it contains a number, paste the copied text that number of times.
Here are a few examples.
[ten ]ten [3]
-> ten ten ten ten ten
[one hundred and ]one, []two, []three
-> one hundred and one, one hundred and two, one hundred and three
[100][repeat me][2]
-> repeat merepeat merepeat me
(pasting nothing 100 times is still nothing)
Notes:
- Although it is possible, nested loops will not be tested.
- The number inside the bracket will always be a positive integer (1, 2, 3...).
- All inputs will be valid (no unclosed brackets, etc)
More examples in the smaple tests.
Good luck!
Check out the rest of the kata in this series!
Regular Expressions
Similar Kata:
Stats:
Created | Dec 8, 2023 |
Published | Dec 12, 2023 |
Warriors Trained | 221 |
Total Skips | 6 |
Total Code Submissions | 266 |
Total Times Completed | 96 |
Python Completions | 96 |
Total Stars | 6 |
% of votes with a positive feedback rating | 98% of 33 |
Total "Very Satisfied" Votes | 32 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 10 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |