Spoiler for Codes:
PHP Code:
import java.io.*;
class balikString {
public static void balikString(String buffer, int size) {
int i,j;
for(i=0;i<size-1;++i) {
char tmp=buffer.charAt(0);
for(j=0;j<size-i-1;++j) {
buffer.charAt(j)=buffer.charAt(j+1);
} buffer.charAt(j)=tmp;
}
}
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in),1);
String strBilangan=null,buffer=null;
int t;
do {
strBilangan=null;
try {
strBilangan=br.readLine().trim();
} catch(IOException ioe) {
System.exit(1);
} t=Integer.parseInt(strBilangan);
} while((t<1)||(t>25));
while(t>0) {
System.out.println();
do {
buffer=null;
try {
buffer=br.readLine().trim();
} catch(IOException ioe) {
System.exit(1);
}
} while(buffer==null);
balikString(buffer,buffer.length());
System.out.println(buffer);
--t;
}
}
}
Spoiler for Compilation Info:
Code:
Main.java:9: error: unexpected type
buffer.charAt(j)=buffer.charAt(j+1);
^
required: variable
found: value
Main.java:10: error: unexpected type
} buffer.charAt(j)=tmp;
^
required: variable
found: value
2 errors
ideone = [url]http://S E N S O R/NQdXT1[/url]