Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- char s[100], aux[100];
- int main() {
- gets(s);
- char *p = strtok(s, " ");
- while (p) {
- int n = strlen(p);
- if (n >= 3) {
- char ch = p[0];
- strcpy(p, p + 1);
- p[n - 1] = ch;
- }
- strcat(aux, p);
- strcat(aux, " ");
- p = strtok(NULL, " ");
- }
- aux[strlen(aux) - 1] = '\0';
- strcpy(s, aux);
- puts(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement