Created
June 11, 2011 15:34
-
-
Save ileacristian/1020674 to your computer and use it in GitHub Desktop.
just some test code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sir = gets | |
array = sir.split | |
hash = {} | |
for i in array do | |
hash[i] = 0 | |
end | |
for i in array do | |
hash[i]+=1 | |
end | |
hash.each do|numar,nr_aparitii| | |
if nr_aparitii == 2 | |
puts "numarul care apare de 2 ori este #{numar}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment