0
Somebody please explain me The Spy Life coding challenge
4 ответов
+ 3
Reverse the string and remove everything that is not a letter or spaces.
+ 3
This returns a new string keeping letters and space:
str.replaceAll("[^A-Za-z ]", "")
+ 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);
}
}
0
Can you show me how to remove 'em