Kiska41384
09.10.2021 00:38

Перевод из паскаля в питон var
len, max, count: longint;
s, s1: string;
maxC: char;
f: text;
begin
assign(f,'C:\24.txt');
reset(f);
readln(f, s);
len := length(s);
s1 := '';
for i:integer := 1 to len-2 do begin
if (s[i] = s[i+2]) then
s1 := s1.Substring(0, s1.LastIndexOf(s[i+1])) + s[i+1] + s1.Substring(s1.LastIndexOf(s[i+1]));
end;
len := length(s1);
max := 1;
count := 0;
for i:integer := 1 to len-1 do begin
if (s1[i] = s1[i+1]) then count := count + 1
else count := 0;
if count > max then begin
max := count;
maxC := s1[i];
end;
end;
writeln(maxC);
end.

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
khezh073
07.05.2023 19:44
1)
#include <iostream>
#include <math.h>

using namespace std;

int main() {
 int a;
 cin >> a;
 int d = a%10;
 string s = "yes";
 while(abs(a) > 0) {
   if(a%10 != d) {
     s = "no";
     break;
   }
   a/=10;
  }
  cout << s << endl;
}
2)
#include <iostream>
#include <math.h>

using namespace std;

int main() {
 int a;
 cin >> a;
 int d = a%10;
 a/=10;
 string s = "no";
 while(abs(a) > 0) {
  if(a%10 == d) {
    s = "yes";
    break;
  }
  d = a%10;
  a/=10;
  }
  cout << s << endl;
}
0,0(0 оценок)
Ответ:
Аленушка54545454
07.05.2023 19:44
1)
#include <iostream>
#include <math.h>

using namespace std;

int main() {
 int a;
 cin >> a;
 int d = a%10;
 string s = "yes";
 while(abs(a) > 0) {
   if(a%10 != d) {
     s = "no";
     break;
   }
   a/=10;
  }
  cout << s << endl;
}
2)
#include <iostream>
#include <math.h>

using namespace std;

int main() {
 int a;
 cin >> a;
 int d = a%10;
 a/=10;
 string s = "no";
 while(abs(a) > 0) {
  if(a%10 == d) {
    s = "yes";
    break;
  }
  d = a%10;
  a/=10;
  }
  cout << s << endl;
}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота