1
0
Given a string and integer n, split the string at n character, and print as follows: Ex)
laptop 3
should print lap top
laptop 2
should print la pt op
(see how it splits the string at every 2nd char)
Special cases:
laptop 0
should print laptop
(since we split at every 0th char, thus none)
laptop 9
should print laptop
(since length of laptop < 9, so no splitting)
bob 2
should print bo b
(we split at the o
(2nd char), but then there aren't enough characters after, so we just leave as is`
You may assume n >= 0
1What does "print it together" mean? Print with spaces in between, or just print it in any clear format? – ETHproductions – 2017-07-07T21:51:18.760
@ETHproductions in the format I have specified, sorry for the confusing – K Split X – 2017-07-07T21:52:26.513
May we print more spaces after the string output? – dzaima – 2017-07-07T21:53:38.777
@dzaima no. thats why I made it so that if you do not enough characters after splitting, you just print the rest of the string (no extra spaces after the rest of the string has been printed) – K Split X – 2017-07-07T21:55:07.580
Not a duplicate: This one is only part of the other challenge - and it allows builtins. – Titus – 2017-07-13T01:41:16.090
Can I print linebreaks instead of spaces? – Titus – 2017-07-13T01:45:02.710