#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
bool compare(string s1, string s2)
{
transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
return s1 == s2;
}
int main() {
string s[] = {"sTAck", "STACk", "STAcK", "SSTTAACCKK", "stack", "Extack"};
for(int i = 0; i < 6; i++)
cout << s[i] << (compare(s[i], "stack") ? " OK" : " NOK") << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmJvb2wgY29tcGFyZShzdHJpbmcgczEsIHN0cmluZyBzMikKewoJdHJhbnNmb3JtKHMxLmJlZ2luKCksIHMxLmVuZCgpLCBzMS5iZWdpbigpLCA6OnRvdXBwZXIpOwoJdHJhbnNmb3JtKHMyLmJlZ2luKCksIHMyLmVuZCgpLCBzMi5iZWdpbigpLCA6OnRvdXBwZXIpOwoJcmV0dXJuIHMxID09IHMyOwp9CgppbnQgbWFpbigpIHsKCQoJc3RyaW5nIHNbXSA9IHsic1RBY2siLCAiU1RBQ2siLCAiU1RBY0siLCAiU1NUVEFBQ0NLSyIsICJzdGFjayIsICJFeHRhY2sifTsKCQoJZm9yKGludCBpID0gMDsgaSA8IDY7IGkrKykKCQljb3V0IDw8IHNbaV0gPDwgKGNvbXBhcmUoc1tpXSwgInN0YWNrIikgPyAiIE9LIiA6ICIgTk9LIikgPDwgZW5kbDsKCQoJcmV0dXJuIDA7Cn0=