Skip to main content
Back to problems
Codeforces
Medium
Strings
Math
Unary

Convert a number from decimal to unary notation using a custom digit-to-symbol mapping.

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.
Problem Statement

Problem

You are given a non-negative integer written in decimal. Convert it to a unary representation using the following rules:

  • Each decimal digit is replaced by a corresponding sequence of 0s.
  • The length of the sequence depends on the digit value.
  • The output is formed by concatenating the sequences for all digits in order.

This is an implementation-style string transformation problem: interpret the input number digit by digit and build the required unary string exactly as specified by the encoding rules.

Goal

Produce the transformed representation for the given input number.

Input Format

  • A single non-negative integer as a string or numeric token.
  • The exact encoding rules are derived from the problem statement and must be followed character by character.

Output Format

  • Print the unary-encoded representation of the given number.
  • Do not print extra spaces or extra lines beyond the required output.

Constraints

  • The input is a valid non-negative integer.
  • The answer should be produced using straightforward iteration over the digits.
  • Large inputs may require processing the number as a string rather than as an integer type.
Examples
Sample cases returned by the problem API.

Example 1

Input

12

Output

0010

Explanation

The digits are transformed independently and concatenated according to the unary encoding rule.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.