0

Somebody please explain me The Spy Life coding challenge

11th Jan 2020, 2:04 PM
Anirudh Singh
Anirudh Singh - avatar
4 Antworten
+ 3
Reverse the string and remove everything that is not a letter or spaces.
11th Jan 2020, 2:29 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
This returns a new string keeping letters and space: str.replaceAll("[^A-Za-z ]", "")
12th Jan 2020, 1:48 AM
John Wells
John Wells - avatar
+ 1
import java.util.*; public class Program { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s=sc.nextLine(); String d=""; String e=""; for(int i=0;i<s.length();i++) if(s.charAt(i)>=65&&s.charAt(i)<=90|| s.charAt(i)>=97&&s.charAt(i)<=122|| s.charAt(i)==32) d+=s.charAt(i); for(int i=d.length()-1;i>=0;i--) e+=d.charAt(i); System.out.println(e); } }
26th Feb 2020, 4:37 PM
Vignesh KR
Vignesh KR - avatar
0
Can you show me how to remove 'em
11th Jan 2020, 2:40 PM
Anirudh Singh
Anirudh Singh - avatar