#include <bits/stdc++.h>
using namespace std;
int main() {
char a,b,r,p,s;
cin>>a>>b;
if(a==p and b==p){
cout<<p;
}else if(a==r and b==r){
cout<<r;
}else if(a==s and b==s){
cout<<s;
}else if(a==p and b==r){
cout<<s;
}else if(a==r and b==p){
cout<<s;
}else if(a==s and b==r){
cout<<p;
}else if(a==r and b==s){
cout<<p;
}else if(a==p and b==s){
cout<<r;
}else if(a==s and b==p){
cout<<r;
}
return 0;
}
Объяснение:
у меня там ошибка, не могу понять из за чего
begin
var n := ReadInteger('n=');
var a := MatrixRandom(n, n, 0, 10);
println(a);
var d := new System.Collections.Generic.Dictionary<integer, integer>();
for var i := a.GetLowerBound(0) to a.GetUpperBound(0) do
for var j := a.GetLowerBound(1) to a.GetUpperBound(1) do
begin
if d.ContainsKey(a[i, j]) then
d[a[i, j]] += 1
else
d.Add(a[i, j], 1);
end;
var p := d.OrderByDescending(x -> x.Value).First();
println('Чаще всего встречается ' + p.Key + ', ' + p.Value + ' раз');
end.