Ruby solution using comparator
\ndef reorder_log_files(logs)\n  comp = -> (log1, log2) {\n    words1, words2 = log1.split(" ", 2) , log2.split(" ", 2)\n    compare = words1[1] <=> words2[1]\n
```\ndef reorder_log_files(logs)\n  comp = -> (log1, log2) {\n    words1, words2 = log1.split(" ", 2) , log2.split(" ", 2)\n    compare = words1[1] <=> words2[1]\n    compare == 0 ? words1[0] <=> words2[0] : compare\n  } \n  letter_logs = []\n  digit_logs = []\n  logs.each { |log|\n    if number?(log.split(" ")[1])\n      digit_logs << log\n    else\n      letter_logs << log\n    end\n  }\n  letter_logs.sort(& comp) + digit_logs\nend\n\ndef number?(c)\n  true if Float c rescue false\nend\n```
['Ruby']