字符串的展开
来源:互联网 发布:邮票交易软件下载 编辑:程序博客网 时间:2024/06/05 02:42
var
p1,p2,p3,i,j,n,l:longint;
ic,k:char;
s,ss,s2:ansistring;
function check(c,cc:char):boolean;
var biao:longint;
begin
biao:=0;
if ((c in['a'..'z'])and(cc in['a'..'z']))or((c in['0'..'9'])and(cc in['0'..'9'])) then biao:=1;
if (ord(cc)-ord(c)>1)and(c<>'-')and(cc<>'-')and(biao=1) then exit(true);
exit(false);
end;
function down(s:ansistring):ansistring;
var i1,j1:longint;
begin
down:='';
for i1:=length(s) downto 1 do
down:=down+s[i1];
exit(down);
end;
begin
readln(p1,p2,p3);
readln(s);
write(s[1]);
for i:=2 to length(s)-1 do
if s[i]='-' then
begin
ss:='';
if (not check(s[i-1],s[i+1]))and(ord(s[i+1])-ord(s[i-1])<>1) then write('-')
else
if check(s[i-1],s[i+1]) then
begin
if p1=1 then
begin
for ic:=chr(ord(s[i-1])+1)to chr(ord(s[i+1])-1) do
for j:=1 to p2 do
ss:=ss+ic;
end;
if p1=2 then
begin
for ic:=chr(ord(s[i-1])+1)to chr(ord(s[i+1])-1) do
for j:=1 to p2 do
ss:=ss+upcase(ic);
end;
if p1=3 then
begin
for ic:=chr(ord(s[i-1])+1)to chr(ord(s[i+1])-1) do
for j:=1 to p2 do
ss:=ss+'*';
end;
if p3=1 then write(ss)
else write(down(ss));
end;
end
else write(s[i]);
write(s[length(s)]);
end.
p1,p2,p3,i,j,n,l:longint;
ic,k:char;
s,ss,s2:ansistring;
function check(c,cc:char):boolean;
var biao:longint;
begin
biao:=0;
if ((c in['a'..'z'])and(cc in['a'..'z']))or((c in['0'..'9'])and(cc in['0'..'9'])) then biao:=1;
if (ord(cc)-ord(c)>1)and(c<>'-')and(cc<>'-')and(biao=1) then exit(true);
exit(false);
end;
function down(s:ansistring):ansistring;
var i1,j1:longint;
begin
down:='';
for i1:=length(s) downto 1 do
down:=down+s[i1];
exit(down);
end;
begin
readln(p1,p2,p3);
readln(s);
write(s[1]);
for i:=2 to length(s)-1 do
if s[i]='-' then
begin
ss:='';
if (not check(s[i-1],s[i+1]))and(ord(s[i+1])-ord(s[i-1])<>1) then write('-')
else
if check(s[i-1],s[i+1]) then
begin
if p1=1 then
begin
for ic:=chr(ord(s[i-1])+1)to chr(ord(s[i+1])-1) do
for j:=1 to p2 do
ss:=ss+ic;
end;
if p1=2 then
begin
for ic:=chr(ord(s[i-1])+1)to chr(ord(s[i+1])-1) do
for j:=1 to p2 do
ss:=ss+upcase(ic);
end;
if p1=3 then
begin
for ic:=chr(ord(s[i-1])+1)to chr(ord(s[i+1])-1) do
for j:=1 to p2 do
ss:=ss+'*';
end;
if p3=1 then write(ss)
else write(down(ss));
end;
end
else write(s[i]);
write(s[length(s)]);
end.
0 0
- 字符串的展开
- 字符串的展开
- 字符串的展开
- 字符串的展开
- 【b702】字符串的展开
- P1098 字符串的展开
- 字符串的展开
- 字符串的展开
- 字符串的展开
- 35:字符串的展开
- B: 字符串的展开
- 35:字符串的展开
- [洛谷1098]字符串的展开
- 算法训练 字符串的展开
- 洛谷 P1098 字符串的展开
- 洛谷1098 字符串的展开
- 洛谷1098 字符串的展开
- 洛谷 P1098 字符串的展开
- 资深人士对大数据的解析
- android google 分屏 多窗口 popup无法显示故障分析
- Python机器视觉编程常用数据结构与示例
- 单例模式
- 1199
- 字符串的展开
- C# 6 与 .NET Core 1.0 高级编程
- 建造者模式
- 远程安装虚拟机
- 计算机网络TCP探究
- xxx.com重定向为www.xxx.com
- 面试题12:打印1到最大的n位数
- 【模板】快速排序
- android中string为空时释放错误