The following program converts an expression from infix to postfix notation. The conversion is carried out with the help of a stack. For example, to turn the expression (A + B) into the postfix form A B +, we ignore the left parenthesis, convert the A to postfix form, we store the + operator on the stack, we convert B to postfix form and then, when find the right parenthesis, we pop the + operator from the top of the stack. In particular, the following implementation works only for the addition and multiplication of integers.

A full implementation of Shunting Yard algorithm can be found in the following project:

Valuation Calculator of Infix Mathematical Expressions

You should know that the implementation of the algorithm does not take into account issues of data input validation or proper management of dynamic memory (e.g. avoiding memory leaks) because it is only necessary to highlight the logic of the algorithm.

```#include <iostream>

#include <cstdlib>
#include <cstring>

#include "STACK.h"

using namespace std;

int
main (int argc, char *argv[]) {
if (!argv)
return EXIT_FAILURE;

char * a = argv;
int N = strlen (a);

STACK<char> ops (N);

for (int i = 0; i < N; i++) {
if (a[i] == ')')
cout << ops.pop () << " ";

if ((a[i] == '+') || (a[i] == '*'))
ops.push (a[i]);

if ((a[i] >= '0') && (a[i] <= '9'))
cout << a[i] << " ";
}

cout << endl;

return EXIT_SUCCESS;
}```
{"ft_lang_label":"__label__en","ft_lang_prob":0.7326016,"math_prob":0.9802317,"size":1381,"snap":"2021-43-2021-49","text_gpt3_token_len":337,"char_repetition_ratio":0.104575165,"word_repetition_ratio":0.0,"special_character_ratio":0.29326576,"punctuation_ratio":0.12547529,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99736464,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-16T09:27:24Z\",\"WARC-Record-ID\":\"<urn:uuid:cad83bcb-07f0-4920-a880-2ec45c1152ea>\",\"Content-Length\":\"182449\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:baf2109f-51c1-4202-8dd9-56fe1ae0a0c4>\",\"WARC-Concurrent-To\":\"<urn:uuid:e7d40f14-cb12-428a-aff4-13cc8ad32164>\",\"WARC-IP-Address\":\"192.0.78.24\",\"WARC-Target-URI\":\"https://efxa.org/2011/03/26/infix-to-postfix/\",\"WARC-Payload-Digest\":\"sha1:XPWLLAVBBGV3SJKDOHKFWA2RHPQLJFCA\",\"WARC-Block-Digest\":\"sha1:SIWBEMU45XZV5YNP5XWSYVJXWT4TQYDA\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323584554.98_warc_CC-MAIN-20211016074500-20211016104500-00510.warc.gz\"}"}