![](https://i-blog.csdnimg.cn/blog_migrate/3bb9303a4d926afe246608385ac7e2be.png)
#include<bits/stdc++.h>
using namespace std;
int main(){
char a,b;
cin>>a>>b;
if(a==b){
printf("2\n%c\n%c%c",a,b,b);
}else{
printf("4\n%c\n",a);
printf("%c%c\n",a,b);
printf("%c%c\n",b,a);
printf("%c",b);
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/96c0a0c6f38066c891a160b170075155.png)
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using pq = priority_queue<int>;
void solve() {
int n;
cin >> n;
vi a(n + 1);
int ans = 1;
for(int i = 1; i <= n; i++) {
int x;
cin >> x;
if(x > n) ans = 0;
else a[x]++;
}
for(int i = 1; i <= n; i++) {
if(a[i] != 1) ans = 0;
}
if(ans) {
cout << 1 << endl << 1 << ' ' << n + 1;
}
else cout << 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while(t--) {
solve();
}
return 0;
}