P12851 [HackerEarth] xaviers challenge
普及
题目描述

Xavier asks his friend to perform a particular task.The task is to find out the ASCII value of each character of a given STRING and then add them up to find the weight of the given string as 'W',now after finding out the weight his task is to divide the weight of string W with the length of string 'L'such that the final answer is 'F' rounded of to previous integer value in case of float or double value.

Now Xavier introduces a twist in the tail the twist seems to be as follows:-

1.If 'F' is odd then to needs to find out reverse of the given string.For eg:- if 'F'
is 109 and input string is xyzabc the output must be cbazyx.

2.If 'F' is even then print the original string.

INPUT

First line inputs the no of test cases T.

Second line inputs the string on which the task is to be performed.

OUTPUT

T no of outputs according to the above task.

Constraints

T ≤ 100.
L ≤ 100.

SAMPLE INPUT
1
xyzabc

SAMPLE OUTPUT
cbazyx

Explanation

The input string is "xyzabc"
then,

The ASCII value of x is 120.

The ASCII value of y is 121.

The ASCII value of z is 122.

The ASCII value of a is 97.

The ASCII value of b is 98.

The ASCII value of c is 99.

W=657.

F=109.

So output="cbazyx".

输入格式

见题面

输出格式

见题面

样例输入
1 xyzabc SAMPLE
样例输出
cbazyx