Reverse Text

From ElectronicWar

Jump to: navigation, search
Challenge Information for Reverse Text
Challenge Reverse Text
Code 1
Input Example Hello
Output Example olleH
Level 10
Profit $1500
Experience 10 to each stat
Description Output what is given in reverse.


[edit] Solution

string str = getInputString();
string out = "";
int len = strlen(str);
int i = 0;
while(i < len){
     out = out + substr(str,len-i-1,len-i);
     i = i+1;
}
setOutputString(out);
Personal tools