0

2 questions

1. Why does the @ symbol come after numbers, and how can I fix this? 2. How can I make the output successfully print and sort new lines? Example: Input: cvg Avf bph Output: cgv Afv bhp https://code.sololearn.com/WkOPxi62VxAy/?ref=app

21st Jul 2018, 5:01 AM
Daniel Cooper
Daniel Cooper - avatar
9 Answers
+ 1
Daniel Cooper 1. @ symbol is sorted after numbers because of their ASCII values. That's the same reason why 'bCa' will be sorted as 'Cab'. Check it out here https://theasciicode.com.ar/ 2.split the input text by '\n'. Then sort them individually.
21st Jul 2018, 5:13 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Read codes for more details. lol https://code.sololearn.com/WadTGzYScP7g/?ref=app
21st Jul 2018, 7:42 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 1
https://code.sololearn.com/WGmF39mkVoNC/?ref=app
22nd Jul 2018, 7:05 AM
CalviŐ˛
CalviŐ˛ - avatar
0
Can I have an example? It'll help me understand better. Also, how can I fix the @ problem?
21st Jul 2018, 6:19 AM
Daniel Cooper
Daniel Cooper - avatar
0
CalviŐ˛ Thanks! But I have one more question. How can I make it so that spaces aren't ignored?
21st Jul 2018, 6:25 PM
Daniel Cooper
Daniel Cooper - avatar
0
Daniel Cooper Add out = out.replace(/ /g, ' '); before output the string
22nd Jul 2018, 12:57 AM
CalviŐ˛
CalviŐ˛ - avatar
0
I can't seem to get it to work. Can I have an example? xD I'm not very smart
22nd Jul 2018, 4:38 AM
Daniel Cooper
Daniel Cooper - avatar
0
recheck my code
22nd Jul 2018, 4:56 AM
CalviŐ˛
CalviŐ˛ - avatar
0
hmmm let me rephrase I want spaces to be present in the output but not sorted. Sorry for all of the trouble. Everything I try seems to fail ;-;
22nd Jul 2018, 5:02 AM
Daniel Cooper
Daniel Cooper - avatar