while s = gets and a = s.strip.downcase.chars h = a.inject({}) { |h, c| h.merge c => (h[c] || 0) + 1 } puts a.map { |c| h[c] == 1 ? '(' : ')' }.joinend
din dind recede Success (( @
((( )(() ()()() )())()) ))((
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!