#include <iostream>
using namespace std;
string s;
bool checkIsEven(char c, int len){
if(c == '\0')
return len % 2 == 0;
return checkIsEven((*(s.begin()+len+1)), len + 1);
}
int main(){
cin >> s;
checkIsEven(*s.begin(), 0) ? cout << "Even" : cout << "Odd";
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
string s;
bool checkIsEven(char c, int len){
if(c == '\0')
return len % 2 == 0;
return checkIsEven((*(s.begin()+len+1)), len + 1);
}
int main(){
cin >> s;
checkIsEven(*s.begin(), 0) ? cout << "Even" : cout << "Odd";
}