|
|
back to boardVery simple algo Here my algo: #include<iostream> using namespace std; int main(){ char c; int i=0; #ifndef ONLINE_JUDGE freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); #endif while(cin.get(c)){ if(i==0&&c>='A'&&c<='Z'){cout<<c; i=1;}else{ if(c>='A'&&c<='Z')cout<<char(c-'A'+'a'); else cout<<c; } if(c=='.'||c=='!'||c=='?')i=0; } return 0; } Re: Very simple algo Your character count after some trimming is around 225. My character count is 173: #include <stdio.h> int main () { int c,i=1; while ((c=getchar())!=EOF) { putchar(i||c<'A'||c>'Z'?c:c-'A'+'a'); i=c>='A'&&c<='Z'?0:strchr(".?!",c)?1:i; } return 0; } |
|
|