1 solutions
-
0
C :
#include <stdio.h> #include <stdlib.h> #include "string.h" int main() { int i,j,start = 0,len,word_len = 0; char str[100]; while(gets(str)) { len = strlen(str); for(i = 0; i < len-1; i ++) { if(str[i] != ' ') printf("%c",str[i]); else printf("\n"); } printf("\n"); } return 0; }C++ :
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { char ch[10000]; gets(ch); for(int i=0;ch[i]!='\0';i++) { if(ch[i]=='.') cout<<endl; else if(ch[i]!=' ') cout<<ch[i]; else cout<<endl; } // system("PAUSE"); return EXIT_SUCCESS; }Pascal :
var b:longint; s,c:string; begin readln(s); while pos(' ',s)<>0 do begin b:=pos(' ',s); c:=copy(s,1,b-1); delete(s,1,b); writeln(c); end; b:=pos('.',s); delete(s,length(s),1); writeln(s); end.
- 1
Information
- ID
- 16515
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By