判断邮箱输入是否正确:
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
String str1 = scan.nextLine();
char[] c1 = str1.toCharArray();
int a = 0,b=0,c=0;
for(int i=0;i
int num = (int)c1[i];
if(num==64){
int numl = (int)c1[i-1];
int numn = (int)c1[i+1];
int numn1 = (int)c1[i+2];
int numn2 = (int)c1[i+3];
if(((numl>=97&&numl<=122)||(numl>=65&&numl<=90)||(numl>=48&&numl<=57)) && ((numn>=97&&numn<=122)||(numn>=65&&numn<=90)||(numn>=48&&numn<=57))){
a=0;
}else{
a=1;
}
}
if(num == 46){
int numl = (int)c1[i-1];
int numn = (int)c1[i+1];
int numn1 = (int)c1[i+2];
int numn2 = (int)c1[i+3];
if(numn == 90&&numn1 == 111&&numn2 == 109 ){
b=0;
}else{
b=1;
}
}
if(num ==95&&((num>=97&&num<=122)||(num>=65&&num<=90)||(num>=48&&num<=57))){
c=0;
}else{
c=1;
}
}
if(a==1&&b==1&&c==1){
System.out.print("NO");
}else{
System.out.print("YES");
}
}
}