fork download
  1. #include<stdio.h>
  2. int top=0;
  3. char stack[1000];
  4. char pop(){
  5. top--;
  6. return stack[top];
  7. }
  8. void push(char n){
  9. stack[top]=n;
  10. top++;
  11. }
  12. int cmp(char x,char y){
  13. if((x=='*'||x=='/')&&(y=='+'||y=='-'||y=='%')){
  14. return 1;
  15. }
  16. else {return 0;}
  17. }
  18.  
  19. int main(){
  20. int i;
  21. char y,str[500];
  22. gets(str);
  23. for(i=0;str[i]!='\0';i++){
  24. if(str[i]>='0'&&str[i]<='9'||str[i]>='a'&&str[i]<='z'||str[i]=='.'){
  25. printf("%c",str[i]);
  26. }
  27.  
  28. else if(str[i]==')'){
  29. while(1){
  30. y=pop();
  31. if(y!='('){
  32. printf("%c",y);
  33. }
  34. if(y=='(')break;
  35. }
  36.  
  37.  
  38. }
  39. else{
  40.  
  41. if(top!=0&&cmp(str[i],stack[top-1])==1){
  42.  
  43. push(str[i]);
  44.  
  45. }
  46. else{
  47. while(cmp(str[i],stack[top-1])==0){
  48. y=pop();
  49. printf("%c",y);
  50. }
  51. push(str[i]);
  52. }
  53. }
  54. }
  55. while(top!=0){
  56. y=pop();
  57. printf("%c",y);
  58. }
  59.  
  60. return 0;
  61. }
  62.  
Runtime error #stdin #stdout 0s 2056KB
stdin
Standard input is empty
stdout
�����\�@�X&0���\��s��t�0����o���o�����o����� ���t��
���<��o��������t
�<d�0�P�����A�A�A�AH0N�A�C�A�Aa���d�8GC�A�A�A�A�
)tuxu|upuFuGD���\|D6����h���tT���h@"$2*;?xtJFP���l �|Rz@�������p����0������������� \����@;�[ăkÁ���3��S�󐐐����������
��]_^[ă�u�9ǃ������$D�4$D�$D�$,�8$D���'t�����)������������0$l���Á�����SV�1WU�f�f�f�f�f���	��+��”%<��ȉ'��v���t*���1t/��$L�$T�&�����D������$T��D�'��v���D�����P��D���f�f���u��ă�P��U�t҅�v���u҅���f����@���|���Uu�@=�'��&t����ă��hP��Ut҅�t����‰���-��&t�����ă��h��Ut���v���-���f�f�f�f�f�f�$��f�f�����hVQ�h�phRTP���^�1������߅+<���	�%����Ɖ�����*��	t���/��&�����D�ă���W�Q�&�����\��u(<�����D��ă�D������P샅t(<�����D���D����a�]_^[Y�1�e��u��ă�D������P�����D���'����-t���D����J�Ʉ�H����䅋���䅃�D�ƒ�����u+<t%������lj�u/���K��r����䝋���ă�D����L�P�D5��1t*��&��+���(�҅�D�ք)��'�.��0����<–�A�	<�A�&�����䅉������ɄɄă���������P$����QSVW�U�q���$L������h�%������h��%������h��%������h��%���%���5��[ă&�t���������Ák��S����������
iid0.2_CBILGniam_trats_cbil__rahctupstegdesu_nidts_OI_6.os.cbilelbaTenolCMTretsiger_MTI_sessalCretsigeR_vJ___trats_nomg__elbaTenolCMTretsigered_MTI_6.os.mbil��n J 6�� '} ��K�  �%�FאE�Q��@��j�UNG UNG2.os.xunil-dl/bil/dt�QDD�����dt�PDD�H�HH��������$����������4�44�4�44( 4@4��FLE�
F:
0�@(
�@�
��	����	�������������������������D��������t�t������P`�`w#<�<| �B	s�	j ���o���[���o���N�<�<F����> ���o���4$h�h! H�H4�4tnemmoc.ssb.atad.tlp.tog.tog.cimanyd.rcj.yarra_inif.yarra_tini.emarf_he.rdh_emarf_he.atador.inif.txet.tini.tlp.ler.nyd.ler.r_noisrev.ung.noisrev.ung.rtsnyd.mysnyd.hsa