#include #include #include #include #include #include #include #include #include #include #define _USE_MATH_DEFINES #include using namespace std; #define MAX 100000 char ic[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; int main() { string a, b; bool f = true; bool zero = true; cin >> a >> b; for (int i = 0; i < a.length(); ++i) { if (find(ic, ic + 10, a[i]) == end(ic)) { f = false; break; } else { if (zero) { if (i != a.length() - 1 && a[i] == '0') { f = false; break; } else { zero = false; } } } } for (int i = 0; i < b.length() && f; ++i) { if (find(ic, ic + 10, b[i]) == end(ic)) { f = false; break; } else { if (zero) { if (i != b.length() - 1 && b[i] == '0') { f = false; break; } else { zero = false; } } } } cout << (f ? "OK" : "NG") << endl; return 0; }