(String s)
| 1 | class Solution { |
| 2 | public String sortSentence(String s) { |
| 3 | String arr[] = s.split(" "); |
| 4 | String temp[] = new String[arr.length]; |
| 5 | String res=""; |
| 6 | |
| 7 | for(int i=0;i<arr.length;i++) |
| 8 | { |
| 9 | int index = arr[i].charAt(arr[i].length()-1)-'0'; |
| 10 | temp[index-1] = arr[i].substring(0,arr[i].length()-1); |
| 11 | } |
| 12 | for(int i=0;i<temp.length;i++) |
| 13 | { |
| 14 | res+=temp[i]; |
| 15 | res+=" "; |
| 16 | } |
| 17 | return res.trim(); |
| 18 | } |
| 19 | } |
nothing calls this directly
no outgoing calls
no test coverage detected