Please replace all C++ in the text with JAVA
EXAMPLE INPUT
The C++ rules and recommendations in this wiki are a work
in progress and reflect the current thinking of the secure
coding community. Because this is a development website,
many pages are incomplete or contain errors. As rules and
recommendations mature, they are published in report or
book form as official releases. These releases are issued
as dictated by the needs and interests of the secure
software development community.
The CERT C++ Coding Standard does not currently expose
any recommendations; all C++ recommendations have been
removed (moved to The Void section) due to quality concerns
pending further review and development. Create a sign-in
account if you want to comment on existing content.
If you wish to be more involved and directly edit content
on the site, you still need an account, but you'll also
need to request edit privileges.
EXAMPLE OUTPUT
The JAVA rules and recommendations in this wiki are a work
in progress and reflect the current thinking of the secure
coding community. Because this is a development website,
many pages are incomplete or contain errors. As rules and
recommendations mature, they are published in report or
book form as official releases. These releases are issued
as dictated by the needs and interests of the secure
software development community.
The CERT JAVA Coding Standard does not currently expose
any recommendations; all JAVA recommendations have been
removed (moved to The Void section) due to quality concerns
pending further review and development. Create a sign-in
account if you want to comment on existing content.
If you wish to be more involved and directly edit content
on the site, you still need an account, but you'll also
need to request edit privileges.
主程序 (不能修改)
#include "source.c"
我的答案
#include <stdio.h>
#include <string.h>
int main() {
char text[1000];
while(fgets(text,1000,stdin)!=NULL){
int length=strlen(text);
char text1[1000]={0};
strcpy(text1,text);
for (int i = 0; i < length ; ++ i) {
if((text[i]=='C'&&text[i+1]=='+')&&text[i+2]=='+'){
text[i]='J';
text[i+1]='A';
text[i+2]='V';
text[i+3]='A';
for (int j = i+4; j <length+2 ; ++ j) {
text[j]=text1[j-1];
}
}
}
printf("%s",text);
}
}
快点更新作业答案 )0^0(