дешифровки: Const sh = '_.,'; Var St : String; i : Integer; Function DeCode(S : String; Tabl : String; k : Integer) : String; Var j,n : Integer; Begin For j:=1 to Length(S) do Begin n:=Pos(S[j],sh); If n>0 then Begin n:=n+k; While n>Length(sh) do n:=n-Length(sh); While n<=0 do n:=n+Length(sh); S[j]:=sh[n]; end end; DeCode:=S; end; Begin St:='ЗЫФЙГФШРЦ . ШД'; Writeln(Decode(St,sh,-6)); //For i:=-10 to 10 do Writeln(Decode(St,sh,i)); end.
public static void main(String args[]){
java.util.Scanner in = new java.util.Scanner(System.in);
String string = in.nextLine(); char chars[] = new char[4];
chars[0] = in.nextLine().charAt(0); chars[2] = in.nextLine().charAt(0);
for(int sChar = 0; sChar<string.length(); sChar++)
if(string.charAt(sChar)==chars[0])chars[1]++;
else if(string.charAt(sChar)==chars[2])chars[3]++;
System.out.print("\n"+(chars[1]==chars[3]?chars[0]+""+chars[2]:chars[1]>chars[3]?chars[0]:chars[2]));
}
}
дешифровки:
Const sh = '_.,';
Var
St : String;
i : Integer;
Function DeCode(S : String; Tabl : String; k : Integer) : String;
Var j,n : Integer;
Begin
For j:=1 to Length(S) do
Begin
n:=Pos(S[j],sh);
If n>0 then
Begin
n:=n+k;
While n>Length(sh) do n:=n-Length(sh);
While n<=0 do n:=n+Length(sh);
S[j]:=sh[n];
end
end;
DeCode:=S;
end;
Begin
St:='ЗЫФЙГФШРЦ . ШД';
Writeln(Decode(St,sh,-6));
//For i:=-10 to 10 do Writeln(Decode(St,sh,i));
end.