fork(1) download
  1.  
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5.  
  6.  
  7. int main(int argc, char **argv)
  8. {
  9. // 3 bufferakia
  10. char input[1024];
  11. char output[1024];
  12. char buf[128];
  13.  
  14. // arketoi ponters poy deixnoyn to telos twn parapanw, efoson doyleyoyme anapoda
  15. const char *firstInput, *lastInput;
  16. char *curBuf, *lastBuf;
  17. char *curOutput;
  18.  
  19. //input
  20. gets(input);
  21.  
  22. //assignments
  23. firstInput = input;
  24. lastInput = strlen(input) - 1u + input;
  25. lastBuf = buf + sizeof(buf);
  26. curBuf = lastBuf;
  27. curOutput = output;
  28.  
  29. for(;; lastInput--)
  30. {
  31. //pame to input apo to telos pros thn arxh gia na kanoyme reverse se olo to string
  32. // pame kai to bufferaki apo to telos pros thn arxh gia na kanoyme reverse thn leksh
  33. //reveres(x) + reverse(x) = x
  34. *--curBuf = *lastInput;
  35.  
  36. //an exei hdh graftei mia leksh
  37. if( firstInput == lastInput || *lastInput == ' ')
  38. {
  39. //grapse sto pOutput thn leksh
  40. //vevaia efoson thn grafame anapoda sto pBuf, tote to pBuf mas deixnei thn arxh
  41. //ara pame kanonika, apo thn arxh pros to telos
  42. for(;curBuf != lastBuf ;curBuf++)
  43. {
  44. if(*curBuf == ' ')
  45. continue;//skip space
  46. *curOutput++ = *curBuf;
  47. }
  48. //vazoume kai enan keno
  49. *curOutput++ = ' ';
  50.  
  51. //an einai h prwth leksh tote telos
  52. if(firstInput == lastInput)
  53. {
  54. //vevaia allazoyme to keno se \0
  55. *curOutput = 0;
  56. break;
  57. }
  58. }
  59.  
  60. }
  61.  
  62. puts(output);
  63.  
  64. return 0;
  65. }
Success #stdin #stdout 0.01s 1724KB
stdin
A web application that generates random text that you can use in sample web pages or typography samples
stdout
samples typography or pages web sample in use can you that text random generates that application web A