Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Locale;
- import java.util.StringTokenizer;
- public class ssau implements Runnable {
- final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
- BufferedReader in;
- PrintWriter out;
- StringTokenizer tok = new StringTokenizer("");
- public static void main(String[] args) {
- new Thread(null, new ssau(), "", 128 * (1L << 20)).start();
- }
- void init() throws FileNotFoundException {
- Locale.setDefault(Locale.US);
- if (ONLINE_JUDGE) {
- in = new BufferedReader(new InputStreamReader(System.in));
- out = new PrintWriter(System.out);
- } else {
- in = new BufferedReader(new FileReader("input.txt"));
- out = new PrintWriter("output.txt");
- }
- }
- long timeBegin, timeEnd;
- void time() {
- timeEnd = System.currentTimeMillis();
- System.err.println("Time = " + (timeEnd - timeBegin));
- }
- public void run() {
- try {
- timeBegin = System.currentTimeMillis();
- init();
- solve();
- out.close();
- time();
- } catch (Exception e) {
- e.printStackTrace(System.err);
- System.exit(-1);
- }
- }
- String readString() throws IOException {
- while (!tok.hasMoreTokens()) {
- try {
- tok = new StringTokenizer(in.readLine());
- } catch (Exception e) {
- return null;
- }
- }
- return tok.nextToken();
- }
- String readString(String s) throws IOException {
- while (!tok.hasMoreTokens()) {
- try {
- tok = new StringTokenizer(in.readLine(), s + "\n \t");
- } catch (Exception e) {
- return null;
- }
- }
- return tok.nextToken();
- }
- int readInt() throws IOException {
- return Integer.parseInt(readString());
- }
- int readInt(String s) throws IOException {
- return Integer.parseInt(readString(s));
- }
- void solve() throws IOException {
- int n = readInt();
- char[] a = readString().toCharArray();
- String ress="";
- char[] res = new char[5000];
- for(int i=0;i<26;i++)
- {
- res[0]=(char) ('a' + i);
- for(int j=0;j<res.length-1;j++ ){
- if(a[j] == '>' ){
- if((char) (res[j]+1)<'z')
- break;
- else
- {
- res[j+1] = (char)(res[j] + 1);
- }
- }
- if(a[j] == '<' ){
- if(((char) (res[j]-1)<'a'))
- break;
- else
- {
- res[j+1] = (char)(res[j] -1);
- }
- }
- if(a[j] == '=' ){
- res[j+1] = (char)(res[j]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement