Educational Codeforces Round 121 (Rated for Div. 2) ABC(区间求并)

A. Equidistant Letters

直接对原字符串进行排序,这样能保证相同的字母相邻,间隔为0.

#include <iostream>
#include <vector>
#include <algorithm>
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
using namespace std;
int main() {
	int t;
	cin >> t;
	while(t--) {
		string s;
		cin >> s;
		vector<char> v;
		for(auto x : s) v.push_back(x);
		sort(v.begin(), v.end());
		for(auto x : v) cout << x;
		cout << endl;
	}
	return 0;
}

B. Minor Reduction

You are given a decimal representation of an integer

上一篇:678. Valid Parenthesis String


下一篇:316. 去除重复字母