fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. char str[51];
  7. int i, cont_char;
  8. int negrito, italico;
  9.  
  10. while ((scanf(" %50[^\n]", str)) != EOF)
  11. {
  12. italico = 0;
  13. negrito = 0;
  14. cont_char = strlen(str);
  15. for (i = 0; i < cont_char; i++)
  16. {
  17. if (str[i] == '_')
  18. {
  19. if (italico % 2 == 0)
  20. {
  21. printf("<i>");
  22. }
  23. else
  24. {
  25. printf("</i>");
  26. }
  27. italico++;
  28. }
  29. else if (str[i] == '*')
  30. {
  31. if (negrito % 2 == 0)
  32. {
  33. printf("<b>");
  34. }
  35. else
  36. {
  37. printf("</b>");
  38. }
  39. negrito++;
  40. }
  41. else
  42. {
  43. printf("%c.", str[i]);
  44. }
  45. }
  46. printf("[\n]");
  47. }
  48. return 0;
  49. }
Success #stdin #stdout 0s 5304KB
stdin
You _should_ see the new walrus at the zoo!
Move it from *Accounts Payable* to *Receiving*.
I saw _Chelydra serpentina_ in *Centennial Park*.
_ _ __ _ yabba dabba _ * dooooo * ****
_now_I_know_*my*_ABC_next_time_*sing*it_with_me
stdout
Y.o.u. .<i>s.h.o.u.l.d.</i> .s.e.e. .t.h.e. .n.e.w. .w.a.l.r.u.s. .a.t. .t.h.e. .z.o.o.!.[
]M.o.v.e. .i.t. .f.r.o.m. .<b>A.c.c.o.u.n.t.s. .P.a.y.a.b.l.e.</b> .t.o. .<b>R.e.c.e.i.v.i.n.g.</b>..[
]I. .s.a.w. .<i>C.h.e.l.y.d.r.a. .s.e.r.p.e.n.t.i.n.a.</i> .i.n. .<b>C.e.n.t.e.n.n.i.a.l. .P.a.r.k.</b>..[
]<i> .</i> .<i></i> .<i> .y.a.b.b.a. .d.a.b.b.a. .</i> .<b> .d.o.o.o.o.o. .</b> .<b></b><b></b>[
]<i>n.o.w.</i>I.<i>k.n.o.w.</i><b>m.y.</b><i>A.B.C.</i>n.e.x.t.<i>t.i.m.e.</i><b>s.i.n.g.</b>i.t.<i>w.i.t.h.</i>m.e.[
]