Group Duplicate Characters Together in Ruby
This guide will show you a quick and simple way that you can implement a method that can arrange a set of values in a string into characters groups.
Guide Tasks
- Read Tutorial
- Complete the Exercise
Summary
Build a method that can arrange a given string and group them into their characters.
Exercise Description
Define a method that can group a sequence of letters by characters, including unsorted strings and integers.
Example Data
'aaabbbbbbccc' -> ["aaa", "bbbbbb", "ccc"] 'aabbcccca' -> ["aaa", "bb", "cccc"] '14832131' -> ["111", "2", "33", "4", "8"]
Real World Usage
This exercise can help you sort through various types of strings and/or large amounts of data because it makes grouping easy and fast, which will make you more efficient with any project that requires you to implement this exercise.