id
int32
0
32.5k
code
stringlengths
95
8.4k
label
stringclasses
65 values
30,900
int main() { int i=0,n; char ch[500]; while(1) { ch[i]=cin.get(); if(ch[i]=='\n') break; else if(ch[i]!=' ') i++; else if(ch[i-1]!=' ') i++; } n=i; for(i=0;i<n;i++) cout<<ch[i]; return 0; }
62
30,901
//??????? //?? //??????????????????????????????????? //???? //?????????????????? //???? //??????? //???? //Hello world.This is c language. //???? //Hello world.This is c language. int main() { int i,m=0; char c[1000],jg[1000];//?????? cin.getline(c,1000); for(i=0;c[i]!='\0';i++)//??????? { if(c[i]!=' ')//???i????? { jg[m]=c[i];//????m?jg? m++;//m??????????????? } else if(c[i]==' ' && c[i+1]!=' ')//?????? { jg[m]=c[i]; m++; } } jg[m]='\0'; int t=strlen(jg); for(m=0;m<t;m++) { cout<<jg[m]; } return 0; }
62
30,902
int main() { char str[300]; int i; char c; gets(str); for(i=0;(c=str[i])!='\0';i++) { if((c=str[i])==32) { if((c=str[i-1])==32) continue; } printf("%c",str[i]); } printf("\n"); return 0; }
62
30,903
int main() { char *str,*p,*start; str=(char *)calloc(1000,sizeof(char)); for (p=str;*(p-1)!='\n';p++) scanf("%c",p); int countspace=0; start=str; for (p=str;*p!='\n';p++) if (*p==' ') { if (*(p-1)!=' ') start=p; countspace++; if (*(p+1)!=' ') { if (countspace>1) for (p=start+1;*(p-1)!='\n';p++) *p=*(p+countspace-1); countspace=0; p=start+1; } } for(p=str;*(p-1)!='\n';p++) printf("%c",*p); return 0; }
62
30,904
int main() { char sh[1000],ch[500]={0},temp[500]; int n,m,i,j=0,k; gets(sh); n=strlen(sh); for(i=0; i<n; i++) { if(sh[i]!=' ') { ch[j]=sh[i]; j=j+1; } if(sh[i]==' ') { if(sh[i-1]==' ') continue ; if(sh[i-1]!=' ') ch[j]=' '; j=j+1; } } printf("%s",ch); return 0; }
62
30,905
int main() { int j,z=1,n,l; char w[300]; gets(w); for(j=0;j<strlen(w);j++) if(w[j]!=' '||w[j+1]!=' ') printf("%c",w[j]); return 0; }
62
30,906
int main() { char a[100]={0};//???? int i=0,k=0;//???? cin.getline(a,100); for(i=0;a[i]!=0;i++) { if(a[i]!=' ') { cout<<a[i]; k=0;//????????? } else if(a[i]==' ') { k++; if(k==1) { cout<<" ";//???????? } } } return 0; }
62
30,907
void main() {char s[999],*p; int i,j; gets(s); p=s; for(;*p!='\0';p++) if(*p!=' ') printf("%c",*p); else if(*p==' '&&*(p+1)!=' ') printf("%c",*p); }
62
30,908
int main(){ int len,i; char s[100]; gets(s); len=strlen(s); if(s[0]!=' '){ printf("%c",s[0]); } for(i=1;i<len;i++){ if(s[i]!=' '){ printf("%c",s[i]); continue;} if(s[i-1]!=' '&&s[i]==' '){ printf("%c",s[i]); continue;} if(s[i-1]==' '&&s[i]==' '){continue;} } return 0; }
62
30,909
char str[100] = {0}; int flag = 0; int len; void clear (char *a) { if(a == str) { cout << *a ; return; } else if(*a == 32 && flag != 0) clear (a - 1); else if (*a == 32) { flag ++; clear(a-1); cout << ' '; } else { flag = 0; clear (a-1); cout << *a; } } int main() { cin.getline(str,100); len = strlen(str); clear (str+len-1); return 0; }
62
30,910
int main() {char *s; int i,j,flag; s=(char*)malloc(100000*sizeof(char)); gets(s); for(i=0;*(s+i)!='\0';i++) {if(*(s+i)==' ') { if(flag==0) {for(j=i;*(s+j)!='\0';j++) *(s+j)=*(s+j+1);i--;} flag=0;} else flag=1; } puts(s); }
62
30,911
main() { int n,i,j,k; char *p,*pp; p=(char*)calloc(num,sizeof(char)); gets(p); n=strlen(p); pp=(char*)calloc(n,sizeof(char)); i=0;j=0;k=0; while(i<n) { if (*(p+i)==' ') { if (k==0) { *(pp+j)=*(p+i); j++; i++; k++; } else { i++; } } else { *(pp+j)=*(p+i); j++; i++; k=0; } } *(pp+j)='\0'; printf("%s\n",pp); }
62
30,912
int main() { char zfc[266],*a,*k; int n,i,j,s,c=0; gets(zfc); s=strlen(zfc); for(i=0;i<s;i++) { for(a=zfc;*a!='\0';a++) { if(*(a-1)==' '&&*a==' ') { for(a=a;*a!='\0';a++) *a=*(a+1); } } } puts(zfc); return 0; }
62
30,913
/* * extra.cpp * ??????? * Created on: 2012-11-21 * Author: ??? */ int main() { int i; char str[100]; cin.getline(str, 100); cout << str[0]; for (i = 1; i < strlen(str) - 1; i++) { if (str[i] != ' ') { cout << str[i]; } else if (str[i] == ' ' && str[i + 1] == ' ') { continue; } else if (str[i] == ' ' && str[i + 1] != ' ') { cout << ' '; } } cout << str[strlen(str) - 1]; return 0; }
62
30,914
int main() { int i; char *s; s=(char *)malloc(sizeof(char)*1000); gets(s); for(i=0;*(s+i)!='\0';i++) { if(*(s+i)!=' ') printf("%c",*(s+i)); else { while(*(s+i+1)==' ') i++; printf("%c",*(s+i)); } } printf("\n"); return 0; }
62
30,915
int main(){ char str[50]; cin>>str; cout<<str; for(;cin.get()!='\n';) { cin>>str; cout<<" "<<str; memset(str,'\0',sizeof(str)); } cout<<endl; return 0; }
62
30,916
int main() {char a[200],b=' ';int i; gets(a); for(i=0;a[i]!=0;i++) if(a[i]!=b||a[i+1]!=b) printf("%c",a[i]);}
62
30,917
int main() { char str[100],p=1,i; cin.get(str,100); for(i=0;str[i]!='\0';i++)//?????? { if(str[i]!=' ') { if(p==0)//????????????? { cout<<" "<<str[i];//?????????? p=1; } else cout<<str[i]; } else { p=0; } } return 0; }
62
30,918
main() { char str[210]; int i,n; gets(str); printf("%c",str[0]); for(i=1,n=strlen(str);i<n;i++) { if(str[i]==' '&&str[i-1]==' '); else printf("%c",str[i]); } printf("\n"); }
62
30,919
void delsp(char *c) //??????? { int flag = 0, n = 0; //flag???? for (; *(c + n) != '\0'; c++) { if (*(c + n) == ' ') { if (*(c + n + 1) == ' ') { n++; c--; flag = 1; } } if (flag == 1) {*(c + 1) = *(c + 1 + n); flag = 0;} else *c = *(c + n); } *c = '\0'; } int main() { char sen[100]; cin.getline(sen, 100); delsp(sen); cout << sen; return 0; }
62
30,920
//********************************** //*???????.cpp * //*?????? * //*???2011-11-23 * //********************************** char str[101]; //?????? void function(char *q, int flag) //??flag???????????????????????????0??????1 { if (!*q) { return ; //?????????????? } if (*q != ' ') { cout << *q; //??????????????????1 flag = 1; } else if (flag) { cout << " "; //??????????????????????????????0 flag = 0; } return function(q + 1, flag); //??????? } int main() { cin.getline(str,100); //????? function(str, 0); //??????????? return 0; }
62
30,921
char* getmemory(int num) { char *p=(char*)malloc(num*sizeof(char)); //???????? return p; } void main() { char *str,*p1,*a,*b; //str???????,p1????????? int n; //a,b???????????. str=getmemory(100); // ????? p1=a=str; gets(str); n=strlen(str); b=a+n; for(str=a;str<b;) { if(*str==' ') { p1=str; if(*(p1+1)==' ') { p1=str; for(;p1<b-1;p1++){*p1=*(p1+1);} n-=1; } else str++; } else str++; } for(p1=a;p1<a+n;p1++)printf("%c",*p1); }
62
30,922
int main() { int i,j,k; char a[300]={'\0'}; char c[300]={'\0'}; for(i=0;;i++) { a[i]=getchar(); if(a[i]=='\n') {break;} } k=i; //printf("%s",a); c[0]=a[0]; for(i=1,j=1;i<k;) { if(a[i]!=' ') {c[j]=a[i];j++;i++;} if((a[i]==' ')&&(a[i-1]!=' ')) {c[j]=a[i];j++;i++;} if((a[i]==' ')&&(a[i-1]==' '))//'\0'???????? {i++;} //printf("%c",c[j]); } for(i=0;i<j;i++) {printf("%c",c[i]);} return 0; }
62
30,923
int main() { int i, len; char str[200]; cin.getline(str,200); len=strlen(str); cout<<str[0]; for(i=1;i<=len-1;i++) { if(str[i]!=' ' && str[i-1]==' ') cout<<" "<<str[i]; else if(str[i]!=' ' && str[i-1]!=' ') cout<<str[i]; } int x;cin>>x; return 0; }
62
30,924
int main() { char str[1000]; int i = 1, l, j; cin.getline( str, 1000, '\n' ); l = strlen(str); while ( str[i] != '\0' ) { if ( str[i - 1] == ' ' && str[i] == ' ' ) { for ( j = i; j < l - 1; j++ ) { str[j] = str[j + 1]; } l--; } else i++; } for ( i = 0; i < l; i++ ) cout << str[i]; return 0; }
62
30,925
void main() {int i,n; char *p; p=(char*)malloc(100000*sizeof(char)); gets(p); n=strlen(p); for(i=0;i<n;i++,p++) {if(*p!=' ') {printf("%c",*p);} /*???????????*/ if(*p==' ') /*????????????????????????*/ {printf("%c",*p); while(*p==' ') {i++;p++;} i=i-1;p=p-1;} } }
62
30,926
int main() { char a[100], i = 0, j; while (cin.get(a[i])) { if (a[i] == '\n') break; if ((a[i] == a[i - 1]) && (a[i] == 32)) i--; i++; } for (j = 0; j <= i; j++) cout << a[j]; return 0; }
62
30,927
int main() { char str1[200],str2[200] = "",*p,*q,i; p=str1;q=str2; cin.getline(str1,200); for(;*p!='\0';p++) { if(*p==' '&&*(p-1)==' ')//???????? continue; else { *q=*p; q++;//????????????????????????????? } } for(i=0;str2[i]!='\0';i++) cout<<str2[i];//???? cout<<endl; return 0; }
62
30,928
int main (){ char a[300],b[300]; int i,j,n; gets(a); n=strlen(a); j=0; for(i=0;i<=n;i++){ if(a[i]!=' '){ b[j]=a[i]; j++; } else if(a[i]==' '&&a[i+1]!=' '){ b[j]=a[i]; j++; } else if(a[i]=='\0') b[j]=a[i]; } printf("%s",b); return 0; }
62
30,929
int main() { char a[200],b[200]; gets(a); char *p,*q; for(p=a,q=b;(*p)!='\0';p++) { if((p-&a[0])==0) { *q=*p; q++; } else if((*(p-1)==' ')&&((*p)==' ')) continue; else { *q=*p; q++; } } *q='\0'; cout<<b<<endl; return 0; }
62
30,930
int main() { char str[1000]; int i,j,flag=1; cin.getline(str,1000); int len=strlen(str); for(i=0;i<len;i++) { if(flag==0&&str[i]!=' ')cout<<' '; if(str[i]==' ')flag=0; else {flag=1;cout<<str[i];} } return 0; }
62
30,931
int main() { char c[1000]={' '}; int a,b,d,e,f,g,i,j,k,l,m,n,p; for(i=0;i<1000;i++) { scanf("%c",&c[i]); if (c[i]!=' ') printf("%c",c[i]); else if (c[i-1]!=' ') printf("%c",c[i]); if (c[i]=='.') break; } return 7; }
62
30,932
//**************************************** //*??????? ** //*??? 1100012927 ** //*2011.11.29 ** //**************************************** void f(char *); int main() { char n[50]; char *p; cin.getline(n, 50); p = n; f(p); return 0; } void f(char *p) { if (*p == '\0') { return; } if (*p != ' ') { cout << *p; f(++p); } else if(*(p + 1) != ' ') { cout << *p; f(++p); } else f(++p); }
62
30,933
int main(){ char a[100000]; gets(a); int i,l; l=strlen(a); for(i=l-1;i>0;i--){ if(a[i]==' '&&a[i-1]==' ') strcpy(&a[i-1],&a[i]); } printf("%s",a); return 0; }
62
30,934
int main(){ char i=0,aa[100]; gets(aa); char *p,*q; p=aa; while(*p!='\0'){ if(*p!=' ') cout<<*p; if(*p==' '){ cout<<*p; q=p; q++; while(*q==' ') q++; q--; p=q; } p++; } return 0; }
62
30,935
int main() { int i,k,j; char a[1000]; //???? cin.getline(a,1000); k=strlen(a); //?i???? for(i=0;i<k;i++) if(a[i]==' ') { if(a[i+1]==' ') {for(j=i+1;j<k-1;j++) a[j]=a[j+1];a[j]=0;k--;i--;} /*???????k??1?i?1????i*/ } cout<<a; return 0; }
62
30,936
//*************************************************************************** //????????????????? * //????wayne * //?????12.22 * //*************************************************************************** int main() { char sentence[100]; //????????? int i,len; //?????? cin.getline(sentence,100); //?????? len=strlen(sentence); //?????? for (i=0;i<=len-2;i++) //???? { if (sentence[i]==' '&&sentence[i+1]==' ') //????? continue; //??? else cout<<sentence[i]; //???? } cout<<sentence[len-1]<<endl; //??????????? return 0; }
62
30,937
//****************** //**???????** //*?? 1100012915** //******11.29******* //****************** int main() { char start[200], result[200]; //???????? char *p = NULL ; //???? int i = 0, j ; cin.getline( start ,200); //?????? for ( p = start; *p != '\0'; p ++ ) { if( ( *p != ' ') || ( *( p + 1 ) != ' ' ) )//???????????????????????? cout << *p ; //?? } return 0; }
62
30,938
int main() { char word_in[1000],word_out[1000]; int sum,k=0; for(int i=0;i<1000;i++) { word_in[i]=0; word_out[i]=0; } cin.getline(word_in,1000); sum=strlen(word_in); for(int i=0;i<sum;i++) { if(word_in[i]!=32) { word_out[k]=word_in[i]; k++; } if(word_in[i]==32) { if(word_in[i+1]!=32) { word_out[k]=word_in[i]; k++; } } } sum=strlen(word_out); for(int i=0;i<sum;i++) { cout<<word_out[i]; } return 0; }
62
30,939
int main(){ char a[201],b[201]; gets(a); int i,j; int l=strlen(a); for(i=0,j=0;i<l;i++,j++){ int k=0; b[j]=a[i]; if(a[i]==' '){ for(int m=i+1;m<l;m++){ if(a[m]==' '){ k++; }else{ break; } } } i=i+k; } b[j]=0; puts(b); return 0; }
62
30,940
char c[1000]; int i=0; int main( ) { cin>>c[0]; cout<<c[0]; while(c[i]!='\n') { i++; c[i]=cin.get( ); } i=1; while(c[i]!='\n') { if(c[i]==' ') { ++i; continue; } if(c[i]!='\0'&&c[i-1]!=' ') cout<<c[i]; if(c[i]!='\0'&&c[i-1]==' ') cout<<" "<<c[i]; i++; } return 0; }
62
30,941
int main() { char ch[1000]; //scanf("%s", ch); gets(ch); int len = strlen(ch); int i; for(i = 0; i < len; i++) { if(ch[i] != ' ') { printf("%c" , ch[i]); } else { if(ch[i-1] == ' ') { } else { printf(" "); } } } printf("\n"); return 0; }
62
30,942
int main(){ int i,j,c,l; char a[201]; gets(a); l=strlen(a); for(i=0;i<l;i++){ if(a[i]==' '&&a[i+1]==' '){ for(j=i+2;j<l;j++){ if(a[j]!=' '){ break; } } for(c=0;c<l;c++){ a[i+1+c]=a[j+c]; } } } puts(a); return 0; }
62
30,943
int main() { char s[200]; cin.get(s,200); int n=strlen(s); for(int i=0;i<n;i++) { if(s[i]==' '&&s[i+1]==' ') { s[i]='\0'; } } for(int i=0;i<n;i++) { if(s[i]==0)continue; cout<<s[i]; } return 0; }
62
30,944
void main() { int i,n; char *p,q[1000]; gets(q); n=strlen(q); p=q; for(i=0;i<n;i++,p++) { if(*p!=' ') { printf("%c",*p); } /*???????????*/ if(*p==' ') /*????????????????????????*/ { printf("%c",*p); while(*p==' ') { i++; p++; } i=i-1; p=p-1; } } }
62
30,945
//******************** // 1.cpp // ?? 1200018415 // 11 15 //******************* int main() { char str[102]; int i = 0, len = 0, count = 0; cin.getline(str,102); // ????? while (i < strlen(str)) { if (str[i] != ' ') // ?????? { cout << str[i]; // ???? count = 0; // ????0 } if (str[i] == ' ') // ????? { count++; // ???1 if (count == 1) // ?????? cout << str[i]; // ????? } i++; } cout << endl; return 0; }
62
30,946
int main(){ char sb[1000]={'\0'}; gets(sb); for(int i=0;sb[i]!='\0';i++){ if(sb[i]!=' ') printf("%c",sb[i]); else if(sb[i]==' '&&sb[i+1]!=' ') printf(" "); } return 0; }
62
30,947
int main() { char a[1000]; //?????????? int i; char b; int j=0; int c=0; while(1) { b=cin.get(); if(b=='\n') break; // ???? if(b!=32) // ???? ?? { a[j]=b; j=j+1; if(b!=46) c=0; else c=1; } else { c=c+1; if(c>1) continue; //???1?????? else { a[j]=b; //????????? j=j+1; } } } for(i=0;i<j;i++) cout<<a[i]; return 0; }
62
30,948
int main(){ char s[100],a[100]={0}; int i,j,k=0,n,l,h=0; gets(s); l=strlen(s); for(j=0;j<l+1;j++){ if(s[j]==' '){ k++; } if(s[j]!=' '&&k==0){ a[h]=s[j]; h++; } if(k>=1&&s[j]!=' '){ a[h]=' '; k=0; a[h+1]=s[j]; h+=2; }if(s[j]=='\0'){ break; } } puts(a); return 0; }
62
30,949
int main(){ int i=0,num,j=1,m,n,k=1; char a[100]; gets(a); num=strlen(a); for(i=0;i<100;i++){ for(j=1;j<num;j++){ if(a[j-1]!=' ' && a[j]==' ' && a[j+1]==' '){m=j;} if(a[j-1]==' ' && a[j]==' ' && a[j+1]!=' '){n=j;break;} if(a[j-1]!=' ' && a[j]==' ' && a[j+1]!=' '){n=num;} }for(k=1;k<=(num-n);k++){ a[m+k]=a[n+k]; if(k==num-n) a[m+k]='\0'; } } puts(a); return 0; }
62
30,950
int main(){ int a=1; char t[101],s[101]; gets(s); t[0]=s[0]; for(int i=1;s[i]!='\0';i++){ if(s[i]!=' '){ t[a]=s[i]; a++; } else if(s[i-1]==' ')continue; else if(s[i-1]!=' '){ t[a]=s[i]; a++; } } t[a]='\0'; printf("%s",t); return 0; }
62
30,951
int main() { char st[100]; int i=0,j,t; cin.getline(st,100,'\n'); for(i=0;st[i]!='\0';i++) { if(st[i]==' '&&st[i+1]==' ') { for(j=i+1;st[j]==' ';j++) { for(t=j;st[t]!='\0';t++) st[t]=st[t+1]; j--; } } } for(i=0;st[i]!='\0';i++) cout<<st[i]; return 0; }
62
30,952
/* * hehe.cpp * * Created on: 2012-12-11 * Author:?? * ??????????????????????????????????? */ int main(){ char a[200],*p; int lena,judge=0; cin.getline(a,200); p=a; lena=strlen(a); for(int i=0;i<lena;i++) { if(*p==' '&&judge==0) {judge=1; cout<<*p; } //???????????judge?? if(*p==' '&&judge==1) ; //?????????? if(*p!=' ') {cout<<*p; judge=0; //???????? } p++; } return 0; }
62
30,953
int main() { char in[210]={0},out[210]={0}; cin.getline(in,210); int l=strlen(in); int j=0; for(int i=0;i<l;i++) { if((in[i]!=' ')||(i>0 && in[i-1]!=' ')) { out[j]=in[i];j++; } else { while(i<l && in[i+1]==' ') i++; } } cout<<out; return 0; }
62
30,954
int main() { char array[1000], cur[1000]; cin.getline(array, 1000); int len = strlen(array), step = 0; for (int i = 0; i < len; i++) { if (array[i] != ' ') cur[step++] = array[i]; else { if (i != 0 && array[i - 1] != ' ' && array[i - 1] != '.') cur[step++] = array[i]; } } for (int i = 0; i < step; i++) cout << cur[i]; return 0; }
62
30,955
int main() { char a[1000]; char *p[1000]; int i; cin.getline(a,1000); for(i=0;i<strlen(a);i++) { if(a[i]!=' ') { p[i]=&a[i]; } else { p[i]=NULL; } } for(i=0;i<strlen(a);i++) { if(p[i]!=NULL) { cout<<*p[i]; } else if(p[i+1]!=NULL) { cout<<" "; } else continue; } return 0; }
62
30,956
void move(char*t,int d){ //for(;*(t-1)!=0;t++) *(t-d)=*t; ???? for(;*t!=0;t++) *(t-d)=*t; *(t-d)=*t; } void deal(char*c){ if(*c==0)return; else if(*c!=' ')deal(c+1) ; else{ char*t=c+1; for(;*t==' ';t++); int d=t-c-1; if(d)move(t,d); //deal(t);????t???????? deal(c+1); } } int main() { char c[201]; cin.getline(c,201); deal(c); cout<<c; return 0; }
62
30,957
void main() { char a[100]; int i,j,n,k=0; gets(a); n=strlen(a); for(i=0;i<=(n-1);i++) { if(a[i]!=32) printf("%c",a[i]); if(a[i]==32&&a[i-1]!=32) printf("%c",a[i]); } }
62
30,958
/************************************************************************************************************* * @file .cpp * @author ???? * @date * @description * ??????? */ int main() { char w[1000]; int i = 0, j = 0, flag = 1, l; cin.getline(w, 1000); l = strlen(w); for(i = 0; i < l; i++) { if(w[i] != 32) flag = 1; if(flag) cout << w[i]; if(w[i] == 32) flag = 0; } return 0; }
62
30,959
void main() { char s[2000],a[2000]; int i,k,n,b; gets(s); n=strlen(s); k=0; i=0; while(i<n) { if(isalnum(s[i])) { b=0; a[k]=s[i]; k++; } else if (b<1) { a[k]=s[i]; k++; b++; } i++; } printf("%s",a); }
62
30,960
int main(){ int i,n,r,x=0,y=0; char a[300],b[300]; gets(a); n=strlen(a); if(a[0]==' '){ for(i=1;i<n;i++){ a[i-1]=a[i]; } for(i=0;i<n-1;i++){ if(a[i]!=' '){ y=0; b[x]=a[i]; x++; } if(a[i]==' '&&y==0){ y=1; b[x]=' '; x++; } }} else{ for(i=0;i<n;i++){ if(a[i]!=' '){ y=0; b[x]=a[i]; x++; } if(a[i]==' '&&y==0){ y=1; b[x]=' '; x++; } } } if(b[x-2]==0){ for(i=0;i<x-1;i++){ printf("%c",b[i]); } } else{ for(i=0;i<x;i++){ printf("%c",b[i]); } } return 0; }
62
30,961
void main() { char a; int i=0; for(;a!='\n';) { a=getchar(); if(a!=' ') {printf("%c",a);i=0;} else if((a==' ')&&(i==0)) {i++;printf("%c",a);continue;} else continue; } }
62
30,962
int main() { char c[1000]; int i,j,l; gets(c); l=strlen(c); for(i=0;i<=(l-1);i++) if((c[i]==32)&&(c[i+1]==32)) { i--; for(j=i+1;j<=(l-1);j++) { c[j]=c[j+1]; } } puts(c); return 0; }
62
30,963
int main() { char a[1000]; gets(a); for(char *p=a;*p!='\0';p++) { if(*p==' '&&*(p+1)==' ') { } else cout<<*p; } return 0; }
62
30,964
void main() {char a=' ',b=' '; int i; for (i=1;i<100;i++) {a=b; scanf("%c", &b); if (b==' '&&a==' ') continue; else printf("%c", b); if (b=='.') break; } }
62
30,965
int main(){ char a[1000]; gets(a); int i=0; int m; m=strlen(a); for(i=0;i<m;i++){ if((i==0&&a[i]==' ')||(a[i-1]==' '&&a[i]==' ')){ continue; }else{ printf("%c",a[i]); } } return 0; }
62
30,966
int main() { char str[1000]; memset(str, 0, sizeof(str)); cin.getline(str, 1000, '\n'); for (int i = 0; str[i]; i ++) { if (str[i] != ' ') cout << str[i]; else { if (str[i + 1] != ' ') cout << str[i]; } } cout << endl; return 0; }
62
30,967
int main() { char in[10001]={0}; int i,len; cin.get(in,1000); len=strlen(in); for (i=0;i<=len-1;i++) { if ((in[i]==' ')&&(in[i+1]==' ')) continue;//????????????????????????????????? cout<<in[i]; } return 0; }
62
30,968
int main() { int j=0,i; char a[1000],b[1000],c; for(i=0;i<=1000;i++) {c=getchar(); a[i]=c; if(c=='\n') break; } for(i=0;i<=1000;i++) {if(a[i]!=' '){b[j]=a[i];j++;} if(a[i]==' '&&a[i-1]!=' '){b[j]=a[i];j++;} if(a[i]=='\n'){ b[j]=a[i];break;} else continue; } for(i=0;i<=j;i++) {cout<<b[i];} return 0; }
62
30,969
main() { int i,j; char a[1000]; gets(a); for(i=1;;i++) { if(a[i]==' '&&a[i-1]==' ') { for(j=i;;j++) { a[j]=a[j+1]; if(a[j+1]=='\0') break; } i=i-1; } if(a[i]=='\0') break; } printf("%s",a); getchar(); getchar(); }
62
30,970
int main() { char *p=NULL; //???? char string_1[1000]; //??????????? gets(string_1); p=string_1; int clen,kong=0; clen=strlen(string_1); for(int i=0;i<clen;i++) { if(*(p+i)==' ') { if(*(p+i-1)==' ') { kong++; //???++ for(int j=i;j<clen-kong;j++) { *(p+j)=*(p+j+1); } i--; *(p+clen-kong)='\0'; //?????????????'\0' } } } cout<<p<<endl; }
62
30,971
//************************* //* ?????????? //* ????? //* ???1200012941 //* ???2012?12?2? //************************* int main() { int i, j; char str[100]; cin.getline(str, 100); int len = strlen(str); int flag = 0; char *p = NULL; for (p = str; *p != '\0' ; p++) { if (*p == ' ') { if (flag == 0) { flag = 1; } else { while (*p == ' ') { for (char *pp = p; *pp != '\0'; pp++) { *pp = *(pp + 1); } } flag = 0; } } else { flag = 0; } } for (p = str; *p != '\0'; p++) { cout << *p; } return 0; }
62
30,972
int main(){ int a=0,i,n; char A[101]; gets(A); for(i=0;A[i]!='\0';i++){ if(A[i]!=' '){printf("%c",A[i]);} if(A[i]==' '){ printf(" "); for(n=i;A[n]==' ';n++){ i=n; } } } return 0; }
62
30,973
int main(){ char a[1000]; char *p=a; int len; gets(a); len=strlen(a); while (p<a+len) if ((*p==' ')&&(*(p+1)==' ')) p++; else {cout<<*p; p++;} return 0; }
62
30,974
int main(int argc, char* argv[]) { char str[250]; int i,j,n; gets(str); for(i=0;i<strlen(str);i++) { if(str[i]!=' ') printf("%c",str[i]); if(str[i]==' '&&str[i+1]!=' ') printf(" "); } return 0; }
62
30,975
int main(){ int i,e,u,x=0,y; char z1[201]; gets(z1); e=strlen(z1); for(i=1;i<e;i++){ if((z1[i-1]==' '||z1[i-1]=='1')&&(z1[i]==' ')){ z1[i]='1'; } } for(i=0;i<e;i++){ if(z1[i]=='1'){ }else{ printf("%c",z1[i]); } } return 0; }
62
30,976
int main() { char string[100]; gets(string); int i,j; int num; int count=0; num=strlen(string); for(i=1;i<num;i++) { if(string[i]==' '&&string[i-1]==' ') { for(j=i;j<num;j++) { string[j]=string[j+1]; } count++; string[num-count]='\0'; i=i-1; } } puts(string); getchar(); getchar(); return 0; }
62
30,977
int main(){ int len,i,j; char sz[400]; gets(sz); len=strlen(sz); for(i=0;i<len;i++){ if(sz[i]==' '){ if(sz[i+1]==' '){ for(j=i+1;j<len;j++){ sz[j-1]=sz[j]; } sz[len-1]='\0'; len--; } if(sz[i+1]==' '){ i--; } } } printf("%s",sz); return 0; }
62
30,978
int main() { int i = 0, flag = 0; //i????????????flag??“??”????? char word[100]; cin.getline(word, 200); //????? char *p = word; for(i = 0; *(p + i) != '\0'; i++) { if(flag == 0 && *(p + i) == ' ') //flag = 0?????????????flag = 1???????????? flag = 1; else if (flag == 1 && *(p + i) == ' ') //????????????????????????'['??“??” *(p + i) = '['; else if (flag == 1 && *(p + i) != ' ') //????????????????????flag = 0 flag = 0; } for (i = 0; *(p + i) != '\0'; i++) //????????'[' if(*(p + i) != '[') cout << *(p + i); return 0; }
62
30,979
int main() { int i; char a[250]={','}; gets(a); for(i=0;i<200;i++) { if(a[i]>=65&&a[i]<=(65+26)||a[i]>=97&&a[i]<=(97+26)||a[i]=='.') { printf("%c",a[i]); } else if(a[i]==' ') { if(a[i+1]!=' ') { printf("%c",a[i]); } } else { continue; } } return 0; }
62
30,980
//*********************************************** //??????? //?????? //???2012.12.2 //*********************************************** int main() { char sentence[50]; //???????? char a; int i = 0; //?????????????? char *p = NULL; while ( (a = getchar()) != '\n' ) //???? { sentence[i] = a; i++; } p = sentence; //???p????????? while (p < sentence + i) { if (*p != ' ') { cout << *p; p++; //????????????? } else { cout << *p; //???????? while (*p == ' ') { p++; //??????????? } } } cout << endl; return 0; }
62
30,981
int main() { char s[101]; int b[101]={0}; int length; int i; gets(s); length=strlen(s); for(i=0;i<length;i++) { if(s[i]==' ') { b[i]=1; if(s[i+1]!=' ') { b[i]=0; } } } for(i=0;i<length;i++) { if(b[i]==0) { printf("%c",s[i]); } } return 0; }
62
30,982
int main() { char s[300]; gets(s); int i, l; int flag = 1; l = strlen(s); for (i = 0; i < l; i++) { if (s[i] != ' ') { printf("%c", s[i]); flag = 1; } else if (s[i] == ' ') { if (flag == 0) continue; else { printf("%c", s[i]); flag = 0; } } } putchar('\n'); return 0; }
62
30,983
int main() { int i,n; char a[100]; cin.getline(a,100); n=strlen(a); char *p; p=a; for(i=1;i<=n;i++) { if((*p==' ')&&(*(p+1)==' ')) { p=p+1; continue; } cout<<*p; p=p+1; } return 0; }
62
30,984
int main( ) { char str[100000]; cin.getline(str, 100000); int i;//flag????????? for (i = 1; str[i] != '\0'; ) { if ( str[i] == ' ' && str[i+1] == ' ' ) { for (int j=i+1; str[j]!='\0';j++) str[j]=str[j+1]; } else i++; } cout<<str; return 0; }
62
30,985
main() { char c,d; while((c=getchar())!='\n') { if(c!=' '||d!=' ') putchar(c); d=c; } printf("\n"); return 0; }
62
30,986
//******************************** //*????1.cpp ** //*?????????? ** //*?????? 1200012834 ** //*???2012.11.30 ** //******************************** void del(char str[100]) // ????????del { int i, j, count; // count???????????????? for (i = 0; str[i] != '\0'; i++) { if (str[i] == ' ' && str[i+1] == ' ') // ???????? { count = 0; for (j = i + 1; str[j+1] != '\0'; j++) // ??????????? { str[j] = str[j+1]; count++; // ????????? } str[i+1+count] = '\0'; // i+1+count??????str??? // ????????????\0?? i--; // i????????? } } cout << str; } int main() { char str[100]; cin.getline(str, 100); // ????? del(str); return 0; }
62
30,987
int main(){ char z[1000]; int i,j; gets(z); for(i=0;z[i];i++){ if(z[i]==' '&&z[i+1]==' '){ for(j=i;z[j];j++){ z[j]=z[j+1]; } i--; } } puts(z); return 0; }
62
30,988
//**************************************** //*??? ?????? ** //*????? 1100012996 ** //*???2011.11.23** //**************************************** int main() { int i = 0 ; //i?????? char *p , *m ; //???????? char str[100] ; //???????? gets(str) ; m = str ; p = str ; while( str[i] != '\0' ) { if ( str[i] == ' ' ) //????????????????? { *p = ' ' ; //???????' ' p++ ; //p????????? while ( str[i] == ' ' ) //????????????????? i++ ; *p = str[i] ; //???p????? } else //??????? { *p = str[i] ; p++ ; i++ ; } } *p = '\0' ; cout << m << endl ; //???????? return 0; }
62
30,989
/* * ???????.cpp * Created on: 2012-12-11 * Author: ??? */ int main() { int n; char a[100], *p = a; cin >> a; n = strlen(a); for (int i = 0; i < n; i++) { cout << *(p + i); } while (cin >> a) { cout<<' '; n = strlen(a); for (int i = 0; i < n; i++) { cout << *(p + i); } } return 0; }
62
30,990
int main() { char a[100] = {'\0'}; char *p; cin.get(a, 100, '\n'); p = a; for (int i = 0; a[i] != '\0'; i++) { if (a[i] == ' ') { while (a[i + 1] == ' ') { for (int l = i + 1; a[l] != '\0'; l++) *(p + l) = *(p + l + 1); } } } cout << a; return 0; }
62
30,991
int main() { int i,a,c=0; char zfc[1000],zfc2[1000]; gets(zfc); a=strlen(zfc); for(i=0;i<1000;i++){ zfc2[i]=' '; } for(i=0;i<a;i++){ if(zfc[i]!=' '){ zfc2[c]=zfc[i]; c++; } if(zfc[i]==' '&&zfc[i-1]!=' '){ zfc2[c]=zfc[i]; c++; } } zfc2[c]='\0'; puts(zfc2); scanf("%d",&a); return 0; }
62
30,992
int main () { int i,l,j; char s[max]; gets(s); l=strlen(s); for (i=0;i<l-1;i++) { if(s[i+1]==' '&&s[i]==' ') { for (;s[i+1]==' ';) { for(j=i;j<l-1;j++) { s[j]=s[j+1]; } s[l-1]='\0'; l--; } } } puts(s); return 0; }
62
30,993
int main(){ char s[1100]; int i,j; for (i=0;scanf("%s",s)!=EOF;i++) printf("%s%s",i==0?"":" ",s); printf("\n"); return 0; }
62
30,994
//******************************** //*???1.cpp ** //*?????? 1200012768 ** //*???2012.12.1 ** //*?????????? ** //******************************** int main() { char ch; int flag = 0; while((ch = cin.get()) != '\n') { if (ch != ' ') { cout << ch; flag = 0; } else if (flag == 0) { cout << ' '; flag = 1; } } return 0; }
62
30,995
void s(char[], int); int main() { char a[10000]; cin.getline(a, 1000); int pos = 0, flag = 1; for (; a[pos] != '\0'; pos++) { if (a[pos] == ' ') { if (pos == 0) { for (int i = 0; a[i] != '\0'; i++) a[i] = a[i + 1]; pos--; } else { if (flag == 0) { for (int i = pos; a[i] != '\0'; i++) a[i] = a[i + 1]; pos--; } else flag = 0; } } else flag = 1; } if (flag == 0) a[pos - 1] = '\0'; cout << a << endl; return 0; }
62
30,996
int main() { int i,j,l; char s[210]; gets(s); l=strlen(s); j=0; for(i=0;i<l;i++) { if(s[i]==' ') { if(j==0) { printf("%c",s[i]); j++; } } else { printf("%c",s[i]); j=0; } } return 0; }
62
30,997
int main(){ char a[201], b[201]; int m, n=0, len; gets(a); len=strlen(a); for(m=0;m<len;m++){ if(a[m]==' '&&a[m+1]==' '){}else{ b[n]=a[m]; n++; } } b[n]='\0'; printf("%s", b); return 0; }
62
30,998
int main() { char a,b; int i=1; b=60; for(;i>0;i++) { a=cin.get(); if(a=='\n') break; if(a!=' '||b!=' ') cout<<a; b=a; } return 0; }
62
30,999
int main() { int i,j,k,n,t=0; char s[100]; gets(s); k=strlen(s); for(i=0;i<k;i++) { if(s[i]==' ') { if(s[i+1]==' ') { t=t+1; for(n=i;n>=t-1;n--) { s[n+1]=s[n]; } } } } for(j=t;j<k;j++) printf("%c",s[j]); return 0; }
62