# 1
chr_count = 0
chr_num = 0
for _ in text:
if text[chr_num] == "!":
chr_count += 1
text = text[:chr_num] + text[chr_num+1:]
continue
chr_num += 1
print("Номер 1")
print(text)
print(chr_count)
# 2
for i in text:
if text[chr_num] == "а":
text = text[:chr_num+1] + "бвгд" + text[chr_num+1:]
chr_num += 4
print("\nНомер 2")
# 3
new_text = text
for num in range(1, len(text)+1):
new_text += text[-num]
text = new_text
print("\nНомер 3")
# 4
new_text = ""
for num in range(len(text)):
if num % 2 == 0:
new_text += text[num]
print("\nНомер 4")
#include <iostream>
#include <vector>
using namespace std;
void ins_sort(vector<int>& vec) {
for (int i = 1; i < vec.size(); i++) {
int j = i - 1;
int flag = 0;
int temp = vec[i];
while (j >= 0 && vec[j] > temp) {
vec[j + 1] = vec[j];
j--;
flag++;
}
vec[j + 1] = temp;
if (flag != 0) {
for (int i = 0; i < vec.size(); i++) {
cout << vec[i] << " ";
cout << endl;
signed main() {
int N;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++)
cin >> vec[i];
ins_sort(vec);
return 0;
# 1
chr_count = 0
chr_num = 0
for _ in text:
if text[chr_num] == "!":
chr_count += 1
text = text[:chr_num] + text[chr_num+1:]
continue
chr_num += 1
print("Номер 1")
print(text)
print(chr_count)
# 2
chr_num = 0
for i in text:
if text[chr_num] == "а":
text = text[:chr_num+1] + "бвгд" + text[chr_num+1:]
chr_num += 4
chr_num += 1
print("\nНомер 2")
print(text)
# 3
new_text = text
for num in range(1, len(text)+1):
new_text += text[-num]
text = new_text
print("\nНомер 3")
print(text)
# 4
new_text = ""
for num in range(len(text)):
if num % 2 == 0:
new_text += text[num]
text = new_text
print("\nНомер 4")
print(text)
#include <iostream>
#include <vector>
using namespace std;
void ins_sort(vector<int>& vec) {
for (int i = 1; i < vec.size(); i++) {
int j = i - 1;
int flag = 0;
int temp = vec[i];
while (j >= 0 && vec[j] > temp) {
vec[j + 1] = vec[j];
j--;
flag++;
}
vec[j + 1] = temp;
if (flag != 0) {
for (int i = 0; i < vec.size(); i++) {
cout << vec[i] << " ";
}
cout << endl;
}
}
}
signed main() {
int N;
cin >> N;
vector<int> vec(N);
for (int i = 0; i < N; i++)
cin >> vec[i];
ins_sort(vec);
return 0;
}