#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <string>
#include <stack>

template<typename BiIter> void run(BiIter first, BiIter last) {
    std::size_t dp=0;
    std::unordered_map<std::size_t, int> data;
    std::stack<BiIter> jmps;

    for(auto it=first; it!=last; ++it) {
        switch(*it) {
        case '>': ++dp;       break;
        case '<': --dp;       break;
        case '+': ++data[dp]; break;
        case '-': --data[dp]; break;
        case '.': 
            std::cout << static_cast<char>(data[dp]);
            break;
        case ',': {
            char c;
            std::cin >> c;
            data[dp]=c;
            break;
        }
        case '[': 
            if(data[dp]==0) 
               it=std::find(it, last, ']');
            else 
               jmps.push(it);
            break;
        case ']': 
            it=jmps.top()-1;
            jmps.pop();
            break;
        }   
    }   
}   
void run(const std::string& code) { run(code.begin(), code.end()); }
int main() {
    std::string program="++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.";
    run(program);
} 