22222

ABC 394

Problem 22 of 50

Easy

What to do

You have a string made of numbers. Your task is to keep only the number '2' from the string and remove everything else, then show the new string with only '2's in the same order they appeared.

Key Concepts

string manipulation loops conditional statements

Examples

Input: '20250222'

Output: 22222

Input: '2'

Output: 2

Tips for Beginners

  • Focus on understanding the logic, not memorizing syntax
  • Use print statements to debug your code
  • Don't worry about input parsing - the function handles that for you
  • If stuck, try writing out your solution on paper first

Python Editor

Loading Python...