import java.util.*;
import java.lang.*;
import java.io.*;
// The main method must be in a class named "Main".
class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String str1=sc.nextLine();
int index=0;
int max_length=0;
char ch[]=new char[str1.length()];
Stack<String> st=new Stack<>();
for(int i=0;i<str1.length();i++){
if(str1.charAt(i)==',' || str1 .charAt(i)=='.' || str1.charAt(i)=='!' || i==str1.length()-1){
//System.out.println(max_length+ " "+())
if(max_length <(i-index)){
max_length=i-index;
if(!st.isEmpty()){
st.pop();
}
//System.out.println(str1.substring(index,i));
String res=str1.substring(index,i);
//System.out.println(res);
st.add(res);
}
if(i+1<str1.length()-1) index=i+1;
}
}
if(!st.isEmpty()){
System.out.println(st.peek());
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: