#include <iostream>
#include <vector>
#include <set>
using namespace std;
void solve() {
string str, s;
getline(cin, str);
vector<string> a;
set<char> letters;
bool ok = false;
for(int i = 0; i <= str.length(); i++){
if(i == str.length() || str[i] == ' '){
if(ok)
a.push_back(s);
s.clear();
ok = false;
letters.clear();
}
else{
s += str[i];
ok |= (letters.find(str[i]) != letters.end());
letters.insert(str[i]);
if(a.empty())
cout << "NO";
else
for(auto &i: a) cout << i << " ";
int main(){
solve();
#include <iostream>
#include <vector>
#include <set>
using namespace std;
void solve() {
string str, s;
getline(cin, str);
vector<string> a;
set<char> letters;
bool ok = false;
for(int i = 0; i <= str.length(); i++){
if(i == str.length() || str[i] == ' '){
if(ok)
a.push_back(s);
s.clear();
ok = false;
letters.clear();
}
else{
s += str[i];
ok |= (letters.find(str[i]) != letters.end());
letters.insert(str[i]);
}
}
if(a.empty())
cout << "NO";
else
for(auto &i: a) cout << i << " ";
}
int main(){
solve();
}