-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaitapvenha.cpp
135 lines (125 loc) · 2.37 KB
/
baitapvenha.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include <bits/stdc++.h>
using namespace std;
void chuanhoa(string &s)
{
s[0] = toupper(s[0]);
for (int i=1;i<s.length();i++) s[i] = tolower(s[i]);
}
void bai1()
{
string s;
cin >> s;
for (int i=0;i<s.length();i++)
{
s[i]=tolower(s[i]);
cout << s[i];
}
}
void bai2()
{
string s;
getline(cin,s);
stringstream ss(s);
string phantu;
while (ss >> phantu) cout << phantu << " ";
}
void bai3()
{
string s;
getline(cin,s);
for(int i=0;i<s.length();i++) s[i] = tolower(s[i]);
stringstream ss (s);
string phantu;
while (ss >> phantu)
{
phantu[0] = toupper(phantu[0]);
cout << phantu << " ";
}
}
void bai4()
{
string s;
getline(cin,s);
for (int i=0;i<s.length();i++)
{
s[i] = toupper(s[i]);
cout << s[i];
}
}
void bai5()
{
string s;
getline(cin,s);
stringstream ss (s);
string phantu;
while (ss >> phantu)
{
string chu;
for (int i=0;i<phantu.length();i++)
{
if (phantu[i] >= 'a' && phantu[i] <= 'z' || phantu[i] >= 'A' && phantu[i] <='Z')
{
chu += phantu[i];
}
}
chu[0] = toupper(chu[0]);
for (int i=1;i<chu.length();i++) chu[i] = tolower(chu[i]);
cout << chu << " ";
}
}
void bai6()
{
string s;
getline(cin,s);
stringstream ss (s);
string phantu;
while (ss >> phantu)
{
string chu;
for (int i=0;i<phantu.length();i++)
{
if (phantu[i] >= 'a' && phantu[i] <= 'z' || phantu[i] >= 'A' && phantu[i] <='Z')
{
chu += phantu[i];
}
}
for (int i=0;i<chu.length();i++) chu[i] = tolower(chu[i]);
chu[chu.length()-1] = toupper(chu[chu.length()-1]);
cout << chu << " ";
}
}
void bai7()
{
while (!cin.eof())
{
string s;
getline(cin,s);
cout << s <<" ";
}
}
void bai8()
{
while (!cin.eof())
{
string s;
getline(cin,s);
s[0] = toupper(s[0]);
cout << s << " ";
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
freopen("baitapvenha.inp","r",stdin);
freopen("baitapvenha.out","w",stdout);
//bai1();
//bai2();
//bai3();
//bai4();
//bai5();
//bai6();
//bai7();
bai8();
return 0;
}