Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- char s[100], aux[100];
- int main() {
- gets(s);
- char *p = strtok(s, " ");
- bool ok = false;
- while (p) {
- if (strlen(p) % 2) {
- strcat(aux, strrev(p));
- ok = true;
- } else {
- strcat(aux, p);
- }
- strcat(aux, " ");
- p = strtok(NULL, " ");
- }
- if (!ok) {
- puts("nu exista");
- } else {
- aux[strlen(aux) - 1] = '\0';
- strcpy(s, aux);
- puts(s);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement