19
3
Letters of the words want fairness.
They decided to appear same number of times in a sentence equally.
Example:
Priorities
Will become:
Ppprrioooritttieeesss
Each letter appears 3 times, as the most common letter was i
, appearing 3 times.
It does not matter where you put the repeated letters, as long as they are next to a similar letter.
I.e.:
Pppriooorritttieeesss
is OK (the 'r' letter)
Ppprioororitttieeesss
is not OK (the 'r' letter)
Another example:
invoice
Will become:
innvvooiccee
Another example:
Remittance Advice
Will become:
Rrremmmiitttaannncce Adddvvvice
Space, comma, question mark, quotation, etc. are not considered letters for this challenge. Only need to consider [a-zA-Z]. Just once space is enough, and the order of the letters should remain the same.
The capitalization of letters does not matter, upper and lower case are countes as the same letter. That is: Pip
has 2 'P's and 1 'I', so it will become Piip
.
It is case insensitive letters can be in any form, Piip=piip=piiP=PiiP
This is code-golf
2
Might I suggest using the Sandbox for future challenges to help iron out all the details before posting the question to main
– Jo King – 2018-10-04T07:19:37.423Is " rrreeemmmiiitttaaannncccdddvvv" an acceptable output in the given example (since the order of the distinct letters (as defined as a-z) is still maintained)? (My Jelly answer currently relies on this interpretation being OK.) – Jonathan Allan – 2018-10-04T08:44:56.000
1@JonathanAllan Hmm, although I leave the choice to OP, I highly doubt it. Not only are the non-letter characters (the space) gone, but you've also put all characters next to each other instead of keeping it at the same place. Your output makes the challenge different and easier (imho). – Kevin Cruijssen – 2018-10-04T09:15:00.807
If @JonathanAllan's output is not acceptable, then I suggest rephrasing it as inserting letters into the string to avoid trouble over order and such – Jo King – 2018-10-04T09:17:48.887
1@KevinCruijssen the space is at the left - it is not a letter hence does not need to adhere to "and the order of the letters should remain the same" – Jonathan Allan – 2018-10-04T09:35:39.710
1@JonathanAllan Ah, didn't notice the space, my bad. I completely understand the reasoning you provided in your Jelly answer and based on that it's indeed a valid output, but I would rather see the phrasing changed, then allowing your output, since it would completely change the challenge itself. – Kevin Cruijssen – 2018-10-04T10:14:08.730
@JonathanAllan my bad, i should said insert letters so the structure of the word remain the same (if you remove the inserted letters the word go back to its original status) means only piip (all cases upper and lower) are ok but ppii not ok – asmgx – 2018-10-04T12:24:16.560
Thanks, I deleted my answer. I think you want to specify that the output must contain the input as a subsequence. Either way you should always clarify specification in the post when need be (in addition to replying to a comment) so that others do not need to read comments to decipher the challenge.
– Jonathan Allan – 2018-10-04T16:47:12.187The input can be all in lowercase? – Luis felipe De jesus Munoz – 2018-10-04T18:07:38.590