I'm new to ruby and Im trying to iterate through a string to replace repeated characters with a single instance of each. I want to automate the process using an iterator so I dont have to state each character by hand. Example string:

```
u = %q(a a a a a b b b b c c c c)

```

I want the variable u to return String "a b c" after ensuring all repeated characters have been replaced with a single instance of each.

I've tried

```
u.each.scan(/\w+/).join do |x|

 p u.gsub(/\x+/, x)

 end

```

and that wont work.How can I get around this?