#include <iostream>
using namespace std;

int main()
{
    char ch, next;

    cout << "Enter C program (Ctrl+D to finish):\n";

    while (cin.get(ch))
    {
        if (ch == '/')
        {
            if (cin.get(next))
            {
                // Single-line comment
                if (next == '/')
                {
                    while (cin.get(ch) && ch != '\n')
                        ;

                    if (ch == '\n')
                        cout << '\n';
                }

                // Multi-line comment
                else if (next == '*')
                {
                    while (cin.get(ch))
                    {
                        if (ch == '*')
                        {
                            if (cin.get(next) && next == '/')
                                break;
                        }
                    }
                }

                // Normal division operator
                else
                {
                    cout << '/';
                    cout << next;
                }
            }
        }
        else
        {
            cout << ch;
        }
    }

    return 0;
}