fork download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4.  
  5. int islast(char *word){
  6. int i;
  7. for(i=0;word[i]!='\0';i++)
  8. if(ispunct(word[i]))
  9. return 1;
  10. return 0;
  11. }
  12.  
  13. int canprint(char *printname){
  14. if((strcmp(printname,"of")==0)||(strcmp(printname,"and")==0)||
  15. (strcmp(printname,"the")==0)||(strcmp(printname,"at")==0))
  16. return 0;
  17. return 1;
  18. }
  19.  
  20. main(){
  21. char name[1000][1000][127]={'\0'}; //group, word, char
  22.  
  23. int i=0,j;
  24. for(j=0;scanf("%s",name[i][j])!=EOF;j++){
  25. if (islast(name[i][j])==1){
  26. i++;
  27. j=-1;
  28. }
  29. } //scan all words
  30.  
  31. int a,b;
  32. for(a=0;a<i;a++){
  33. for(b=0;name[a][b][0]!='\0';b++)
  34. if(canprint(name[a][b])==1)
  35. printf("%c",toupper(name[a][b][0]));
  36. printf(" ");
  37. }
  38. }
Success #stdin #stdout 0.03s 125524KB
stdin
the civil works administration. file transfer protocol. chief executive
officer. no problem. the social security administration. ante meridiem.
gross national product. close quarters combat. the agricultural adjustment
act. dynamic host configuration protocol. the civilian conservation corps.
united states geological survey. crime scene investigation.
stdout
CWA FTP CEO NP SSA AM GNP CQC AAA DHCP CCC USGS CSI