Official

A - 22222 Editorial by en_translator


For beginners

One can count the occurrences of 2 in \(S\) and print 2 the same times.

Sample code (C++)

#include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	cin >> s;
	int k = count(s.begin(), s.end(), '2');
	cout << string(k, '2') << '\n';
}

Sample code (Python)

print('2' * input().count('2'))

posted:
last update: