2 questions | Sololearn: Learn to code for FREE!

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

7/21/2018 5:01:47 AM

Daniel Cooper

9 Answers

New Answer

+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.

+1

Read codes for more details. lol https://code.sololearn.com/WadTGzYScP7g/?ref=app

+1

https://code.sololearn.com/WGmF39mkVoNC/?ref=app

0

Can I have an example? It'll help me understand better. Also, how can I fix the @ problem?

0

Calviղ Thanks! But I have one more question. How can I make it so that spaces aren't ignored?

0

Daniel Cooper Add out = out.replace(/ /g, ' '); before output the string

0

I can't seem to get it to work. Can I have an example? xD I'm not very smart

0

recheck my code

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 ;-;