I think my code is alright but when I sumbitted I got Time limit exceeded. Here is my code : http://ideone.com/delpkz