-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1-5.cpp
50 lines (43 loc) · 1.09 KB
/
1-5.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "middle_list.h"
vector <char> itc_strtlist(string str){
vector<char> answ(str.size());
for(size_t i = 0; i<str.size();i++)
answ[i] = str[i];
return answ;
}
string itc_join(vector <char> lst, string sep){
string answ = "";
for(int i = 0;i<lst.size();i++){
answ+=lst[i];
if(i < lst.size()-1)answ+=sep;
}
return answ;
}
string itc_rmstrspc(string str){
string new_s = "";
for (int i = 0; i<str.size(); i++){
if(str[i]!=' '){
new_s+=str[i];
}
}
return new_s;
}
string itc_rmstrchar(string str, string l){
string new_s = "";
for(int i = 0;i<str.size(); i++){
bool is_banned = false;
for(int j = 0; j < l.size() && !is_banned;j++){
if(str[i] == l[j])
is_banned = true;
}
if(!is_banned)new_s+=str[i];
}
return new_s;
}
long long itc_sumlst(const vector <int> &lst){
long long sum = 0;
for(int i = 0; i < lst.size(); i++ ){
sum += lst[i];
}
return sum;
}