r=gets.split(?,)i=(-12..-1).map{|i|(0..6).map{|j|%w{C C# D D# E F F# G G# A A# B}[i+=(59>>j&1)+1]}}.select{|y|r-y==[]}[0]puts"Dorain scale in "+i[0]if i
B,B,D,E,D,B,A,G#,A,G#,E,D,F#,E,F#,E,F#,G#,A
Dorain scale in B
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!