#include <stdio.h>
#include <stdint.h>
int main(void)
{
	int ch = 0; // current character
	int last = 0; // last character
	uint8_t state = 0; // current state
	while ((ch = getchar()) != EOF) // read character until EOF
	{
		switch (state) // check the current state
		{
			case 0: // outside comment, put everything to stdout
			{
				// check if current character might be / - the start of a comment
				switch (ch)
				{
					case '/':
					{
						// if the character is / - the start of a comment, move to state 1
						state = 1;
						break;
					}
					default:
					{
						// no special case, put character to stdout
						putchar(ch);
					}
				}
				break;
			}
			case 1:
			{
				// a comment might be detected, the first / was detected
				// last character was / - it might or might not be a comment - needs confirmation
				switch (ch)
				{
					case '/':
					{
						// if the current character is / - we found a type 1 comment, moving to state 2
						state = 2;
						break;
					}
					case '*':
					{
						// if the current character is * - we found a type 2 comment, moving to state 3
						state = 3;
						break;
					}
					default:
					{
						// no additional / or * found - this is not a comment
						putchar(last); // put the last character to stdout
						putchar(ch); // put the current character to stdout
						state = 0; // move back to state 0
					}
				}
			}
			case 2:
			{
				// we are in a type 1 comment
				// we ignore all characters except newline
				if (ch == '\n')
				{
					// if the character is newline \n we reached the end of the type 1 comment
					// moving back to state 0
					state = 0;
				}
				break;
			}
			case 3:
			{
				// we are in a type 2 comment
				// we ignore all characters except '*' which might mark the end of the comment
				// we do not write any characters to stdout - we are in a comment
				if (ch == '*')
				{
					// if the character is '*' we might reach the end of the comment
					// moving to state 4 to confirm
					state = 4;
				}
				break;
			}
			case 4:
			{
				// we are in the middle of confirming if we found the end of the type 2 comment
				if (ch == '/')
				{
					// we found the ending '/' character for the type 2 comment - we got out of the comment
					// moving back to state 0
					state = 0;
				}
				else
				{
					// we did not find the ending '/' character for type 2 comment
					// we did not get out of the comment
					putchar(last); // sending last character to stdout
					putchar(ch); // sending current character to stdout
					state = 3; // moving back to state 3 - inside a type 2 comment
				}
				break;
			}
		}
		// save the current character in order to have it in the next iteration as the previous character
		last = ch;
	}
	return 0;
}