#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int maxn=1e6+5;
const int maxm=1e6;
char str[maxn];
int main() {
cin >> str + 1;
int n = strlen(str + 1);
for (int i = 1; i <= n; i++) {
if (str[i] == 'W' && str[i + 1] == 'J') {
for (int j = 1; j < i; j++) {
if (str[j] == 'W' && str[j - 1] == 'J') {
cout << "YES" << endl; return 0;
}
}
for (int j = i + 2; j <= n; j++) {
if (str[j] == 'J' && str[j + 1] == 'W') {
cout << "YES" << endl; return 0;
}
}
}
}
cout << "NO" << endl;
return 0;
}