/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
System.out.println("Ingresa tu correo electronico");
String correo = entrada.nextLine();
Pattern pattern = Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(correo);
boolean matchFound = matcher.find();
if(matchFound) {
String user = correo.split("@")[0];
System.out.println(user);
} else {
System.out.println("Correo no válido");
}
}
}