+ 9
[CHALLENGE]
Create a program that removes any number from a String and outputs the new value example: String sololearn = "Solo537learn"; // output = Sololearn
16 Answers
+ 21
https://code.sololearn.com/cTWERkbGpWR5/?ref=app
+ 12
S="Solo537learn"
print (*[i for i in S if not (i.isnumeric())],sep='')
https://code.sololearn.com/cotWa27X3hKt/?ref=app
+ 10
My solution:
• One-liner
• No if statements
• 40 bytes
https://code.sololearn.com/cJGfbCY9FXUC/?ref=app
+ 9
C++:
string s; getline(cin,s);
cout<<regex_replace(str,regex("[\\d]+"),"");
+ 7
JavaScript rocks
https://code.sololearn.com/WIHPPy2g1njW/?ref=app
+ 7
https://code.sololearn.com/cXOpmKdeZKIY/?ref=app
+ 5
C++ version..
https://code.sololearn.com/cqH07gsYspyM/?ref=app
+ 2
https://code.sololearn.com/cmSggQa6rz87/?ref=app
+ 2
SUGGESTION: Also try removing special characters from the imputed string.
For example,
INPUT: benze-6-#/\ne
OUTPUT: benzene
- 2
bhai zara hindi me sikha do yaar