#include <bits/stdc++.h>
using namespace std;
int main(){
    char a[32767],max[100]={'\0'},b[100];
    gets(a);
    bool l;
    int i,s=0,j;
    if(a[0]!=' '){
        s++;
    }
    for(i=s;i<strlen(a)&&a[i]!='.';i++){
        if(a[i]!=' '&&a[i-1]==' '){
            l=0;
            for(j=0;a[i]!=' ';i++){
                if(a[i]=='.')
                    break;
                b[j]=a[i];
                if(b[j]=='a')
                    l=1;
                j++;
            }
            if(l==1&&strlen(b)>strlen(max))
                strcpy(max,b);  
        }   
    }
    if(max[0]!='\0')
        cout<<max;
    else
        cout<<"NO";
    return 0;
    }
/**************************************************************
	Problem: 1111
	User: wengsihan
	Language: C++
	Result: Accepted
	Time:13 ms
	Memory:2076 kb
****************************************************************/