You are on page 1of 2

nomer 2

#include <iostream>
#include <string>
using namespace std;

string StringChallenge(string str) {

cout<<"Enter some text: ";


cin>>str;
string reverseString;

for(long i = str.size() - 1;i >= 0; --i){


reverseString += str[i];
} return str;

int main(void) {

// keep this function call here


cout << StringChallenge(coderbyteInternalStdinFunction(stdin));
return 0;

nomer 3
#include <iostream>
#include <string>
using namespace std;

string SearchingChallenge(string str) {

if((str.length()>=4 && str.length()<=25) &&(str[0]>='a' && str[0]<='z' ||


str[0]>='A' && str[0]<='Z') &&(str[str.length()-1]/='_'))
{
return str;
}
else
{
return "0";
}

int main(void) {

// keep this function call here


cout << SearchingChallenge(coderbyteInternalStdinFunction(stdin));
return 0;

Nomer 4
function StringChallenge(str) {

if(str === str.split("").reverse().join("")) {return str;};


let result = "";
for (let i = 0; i < str.length; i++) {
let items = str[i];
for (let j = i + 1; j < str.length; j++) {
items += str[j];
if (items === items.split("").reverse().join("")) {
if ( result.length < items.length) {result = items;}
}
}
}
return result.length < 3 ? "not possible" : result ;
}

// keep this function call here


console.log(StringChallenge(readline()));

Nomer 5

You might also like