Apparently-Modifying Strings
Description:
For every string, after every occurrence of 'and'
and/or 'but'
, insert the substring 'apparently'
directly after the occurrence(s).
If input does not contain 'and' or 'but', return the same string. If a blank string, return ''
.
If substring 'apparently'
is already directly after an 'and'
and/or 'but'
, do not add another. (Do not add duplicates).
Examples:
Input 1
'It was great and I've never been on live television before but sometimes I don't watch this.'
Output 1
'It was great and apparently I've never been on live television before but apparently sometimes I don't watch this.'
Input 2
'but apparently'
Output 2
'but apparently'
(no changes because 'apparently'
is already directly after 'but'
and there should not be a duplicate.)
An occurrence of 'and'
and/or 'but'
only counts when it is at least one space separated. For example 'andd'
and 'bbut'
do not count as occurrences, whereas 'b but'
and 'and d'
does count.
reference that may help: https://www.youtube.com/watch?v=rz5TGN7eUcM
Similar Kata:
Stats:
Created | May 22, 2018 |
Published | May 23, 2018 |
Warriors Trained | 2922 |
Total Skips | 39 |
Total Code Submissions | 16020 |
Total Times Completed | 1586 |
Python Completions | 674 |
JavaScript Completions | 825 |
Rust Completions | 124 |
Total Stars | 26 |
% of votes with a positive feedback rating | 86% of 255 |
Total "Very Satisfied" Votes | 198 |
Total "Somewhat Satisfied" Votes | 45 |
Total "Not Satisfied" Votes | 12 |
Total Rank Assessments | 4 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |