Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <stdio.h>
- #include <string.h>
- int main() {
- char str[255];
- int i = 0,j = 0,b;
- printf("Input: ");
- gets_s(str);
- while (str[i] != '.') {
- i++;
- if ((str[i] == ' ') || (str[i] == '.')) {
- b = str[i - 1];
- str[i - 1] = str[j];
- str[j] = b;
- j = i + 1;
- }
- }
- printf("%s\n", str);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement