#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
void init();
struct Profile
{
float *score;
string fname, lname, resp, scaleA, scaleB;
public:
Profile()
:score(new float[4])
{
fill(score, score + 4, 0.0);
scaleA = "ESTJ";
scaleB = "INFP";
cin >> fname >> lname >> resp;
}
void Assess(int);
void Eval();
~Profile();
};
int main()
{
init();
int num, w;
Profile* P;
string::iterator k;
for(scanf("%d", &num) ; num-- ;)
{
P = new Profile;
for( w = 1, k = P->resp.begin(); k != P->resp.end(); ++k, ++w)
if (*k == 'A')
P->Assess(w);
P->Eval();
P->~Profile();
}
return 0;
}
void init()
{
freopen("responses.txt","r",stdin);//redirects standard input
freopen("types.txt","w+",stdout);//redirects standard output
cout << "\t\t\tSUBJECT'S PERCENT 'A' RESPONSES PERSONALITY\n"
<< "\t\t\t_______________________________________________\n\n"
<< "|\t NAME\t\t | \tE/I\t | \tS/N\t | \tT/F\t | \tJ/P\t | \tTYPE\t |\n\n";
}
void Profile::Assess(int k)
{
if ( (k-1) % 7 == 0 )
++score[0];
else if ( (k+4) % 7 == 0 || (k+5) % 7 == 0 )
++score[1];
else if ( (k+2) % 7 == 0 || (k+3) % 7 == 0 )
++score[2];
else if ( k % 7 == 0 || (k + 1) % 7 == 0 )
++score[3];
}
void Profile::Eval()
{
for (unsigned w = 0; w < scaleA.length(); ++w)
{
if (w < 1)
{
(int)score[w] < 5 ? scaleA[w] = scaleB[w] : (int)score[w] == 5 ? scaleA[w] = '-' : 0;
score[w] *= 10;
}
else
{
(int)score[w] < 10 ? scaleA[w] = scaleB[w] : (int)score[w] == 10 ? scaleA[w] = '-' : 0;
score[w] *= 5;
}
}
}
Profile::~Profile()
{
printf("|\t%s %s\t |", fname.c_str(), lname.c_str());
for (unsigned w = 0; w < scaleA.length(); ++w)
printf("\t%.1lf\t |", score[w]);
printf("\t%s\t |\n", scaleA.c_str() );
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUg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yZW9wZW4oInR5cGVzLnR4dCIsIncrIixzdGRvdXQpOy8vcmVkaXJlY3RzIHN0YW5kYXJkIG91dHB1dAogICAgY291dCA8PCAiXHRcdFx0U1VCSkVDVCdTICBQRVJDRU5UICAnQScgIFJFU1BPTlNFUyAgUEVSU09OQUxJVFlcbiIKICAgIDw8ICJcdFx0XHRfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuXG4iCiAgICA8PCAifFx0IE5BTUVcdFx0IHwgXHRFL0lcdCB8IFx0Uy9OXHQgfCBcdFQvRlx0IHwgXHRKL1BcdCB8IFx0VFlQRVx0IHxcblxuIjsKfQoKdm9pZCBQcm9maWxlOjpBc3Nlc3MoaW50IGspCnsKICAgIGlmICggKGstMSkgJSA3ID09IDAgKQogICAgICAgICsrc2NvcmVbMF07CiAgICBlbHNlIGlmICggKGsrNCkgJSA3ID09IDAgfHwgKGsrNSkgJSA3ID09IDAgKQogICAgICAgICsrc2NvcmVbMV07CiAgICBlbHNlIGlmICggKGsrMikgJSA3ID09IDAgfHwgKGsrMykgJSA3ID09IDAgKQogICAgICAgICsrc2NvcmVbMl07CiAgICBlbHNlIGlmICggayAlIDcgPT0gMCB8fCAoayArIDEpICUgNyA9PSAwICkKICAgICAgICArK3Njb3JlWzNdOwp9Cgp2b2lkIFByb2ZpbGU6OkV2YWwoKQp7CiAgICBmb3IgKHVuc2lnbmVkIHcgPSAwOyB3IDwgc2NhbGVBLmxlbmd0aCgpOyArK3cpCiAgICB7CiAgICAgICAgaWYgKHcgPCAxKQogICAgICAgIHsKICAgICAgICAgICAgKGludClzY29yZVt3XSA8IDUgPyBzY2FsZUFbd10gPSBzY2FsZUJbd10gOiAoaW50KXNjb3JlW3ddID09IDUgPyBzY2FsZUFbd10gPSAnLScgOiAwOwogICAgICAgICAgICBzY29yZVt3XSAqPSAxMDsKICAgICAgICB9CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgKGludClzY29yZVt3XSA8IDEwID8gc2NhbGVBW3ddID0gc2NhbGVCW3ddIDogKGludClzY29yZVt3XSA9PSAxMCA/IHNjYWxlQVt3XSA9ICctJyA6IDA7CiAgICAgICAgICAgIHNjb3JlW3ddICo9IDU7CiAgICAgICAgfQogICAgICAgIAogICAgfQp9CgpQcm9maWxlOjp+UHJvZmlsZSgpCnsKICAgIHByaW50ZigifFx0JXMgJXNcdCB8IiwgZm5hbWUuY19zdHIoKSwgbG5hbWUuY19zdHIoKSk7CiAgICAKICAgIGZvciAodW5zaWduZWQgdyA9IDA7IHcgPCBzY2FsZUEubGVuZ3RoKCk7ICsrdykKICAgICAgICBwcmludGYoIlx0JS4xbGZcdCB8Iiwgc2NvcmVbd10pOwogICAgcHJpbnRmKCJcdCVzXHQgfFxuIiwgc2NhbGVBLmNfc3RyKCkgKTsKfQ==