Skip to content

Instantly share code, notes, and snippets.

@ileacristian
Created June 11, 2011 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ileacristian/1020674 to your computer and use it in GitHub Desktop.
Save ileacristian/1020674 to your computer and use it in GitHub Desktop.
just some test code
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