-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJSPACE.cpp
55 lines (47 loc) · 1.13 KB
/
JSPACE.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
/////////////////////////////////////
//////////////// Spacje /////////////
//////////// Mateusz Bartos /////////
////////// [email protected] ///////
// http://mbartos.lo3.edu.pl/site/ //
//////////////// 2012 ///////////////
/////////////////////////////////////
#include<iostream>
#include<string>
using namespace std;
int main(){
string str;
while(getline(cin,str))
{
bool spc = false;
for(int i = 0 ; i < str.length() ; i++)
{
if(str[i] == ' ')
{
spc = true;
str.erase(str.begin()+i);
i--;
continue;
}else{
if(spc)
{
int x;
char chr;
chr = str[i];
x = chr;
if(x > 90)
{
x-=32;
chr = x;
str[i] = chr;
spc = false;
}else{
spc = false;
}
}
}
}
cout<<str<<"\n";
cin.sync();
}
return 0;
}