#include <stdio.h>
#include <iostream>
#include <locale.h>
#include <ctime>
int main() {
setlocale(LC_ALL, "rus");
system("chcp 1251");
const int SIZE = 256;
int i, j, ch;
char str[SIZE];
std::cout << "Your string, please" << std::endl;
for (i = 0; i < SIZE - 1 && (ch = getchar()) != -1 && ch != '\n'; i++) {
str[i] = ch;
}
std::cout << "Изначальная строка:\n" << str << "\n\n" << std::endl;
for (i = 0; i < SIZE - 1; i++) {
if (str[i] == '.') {
if (str[i + 1] == '.' && str[i + 2] == '.') {
i += 2;
continue;
else {
for (j = SIZE - 3; j > i; j--) {
str[j + 2] = str[j];
str[i + 1] = '.';
str[i + 2] = '.';
std::cout << "Измененная строка:\n" << str << "\n\n" << std::endl;
return 0;
#include <stdio.h>
#include <iostream>
#include <locale.h>
#include <ctime>
int main() {
setlocale(LC_ALL, "rus");
system("chcp 1251");
const int SIZE = 256;
int i, j, ch;
char str[SIZE];
std::cout << "Your string, please" << std::endl;
for (i = 0; i < SIZE - 1 && (ch = getchar()) != -1 && ch != '\n'; i++) {
str[i] = ch;
}
std::cout << "Изначальная строка:\n" << str << "\n\n" << std::endl;
for (i = 0; i < SIZE - 1; i++) {
if (str[i] == '.') {
if (str[i + 1] == '.' && str[i + 2] == '.') {
i += 2;
continue;
}
else {
for (j = SIZE - 3; j > i; j--) {
str[j + 2] = str[j];
}
str[i + 1] = '.';
str[i + 2] = '.';
i += 2;
}
}
}
std::cout << "Измененная строка:\n" << str << "\n\n" << std::endl;
return 0;
}