文件目录

#include <bits/stdc++.h>
using namespace std;
bool com(string a, string b)
{
    return a.size() > b.size() || a.size() == b.size() && a >= b;
}
string sub(string a, string b)
{
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    while (b.size() < a.size())
        b.push_back('0');
    for (int i = 0; i < a.size(); i++)
    {
        a[i] = a[i] - b[i] + 48;
        if (a[i] < 48)
        {
            a[i] += 10;
            a[i + 1]--;
        }
    }
    while (a.back() == '0')
        a.pop_back();
    reverse(a.begin(), a.end());
    return a;
}
void div(string a, string b)
{
    vector<int> s(a.size(), 0);
    string ys = "";
    for (int i = 0; i < a.size(); i++)
    {
        ys.push_back(a[i]);
        while (com(ys, b))
        {
            ys = sub(ys, b);
            s[i]++;
        }
    }
    int i = 0;
    while (s[i] == 0 && i < a.size() - 1)
        i++;
    for (; i < a.size(); i++)
        cout << s[i];
    cout << endl;
    if (ys.empty())
        cout << 0;
    else
        cout << ys;
}
int main()
{
    string num1, num2;
    cin >> num1 >> num2;
    div(num1, num2);
    return 0;
}