Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.17 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Locale;
  3. import java.util.StringTokenizer;
  4.  
  5. public class ssau implements Runnable {
  6.  
  7. final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
  8.  
  9. BufferedReader in;
  10. PrintWriter out;
  11. StringTokenizer tok = new StringTokenizer("");
  12.  
  13. public static void main(String[] args) {
  14. new Thread(null, new ssau(), "", 128 * (1L << 20)).start();
  15.  
  16. }
  17.  
  18. void init() throws FileNotFoundException {
  19. Locale.setDefault(Locale.US);
  20.  
  21. if (ONLINE_JUDGE) {
  22. in = new BufferedReader(new InputStreamReader(System.in));
  23. out = new PrintWriter(System.out);
  24. } else {
  25. in = new BufferedReader(new FileReader("input.txt"));
  26. out = new PrintWriter("output.txt");
  27. }
  28. }
  29.  
  30. long timeBegin, timeEnd;
  31.  
  32. void time() {
  33. timeEnd = System.currentTimeMillis();
  34. System.err.println("Time = " + (timeEnd - timeBegin));
  35. }
  36.  
  37. public void run() {
  38. try {
  39. timeBegin = System.currentTimeMillis();
  40.  
  41. init();
  42. solve();
  43.  
  44. out.close();
  45. time();
  46. } catch (Exception e) {
  47. e.printStackTrace(System.err);
  48. System.exit(-1);
  49. }
  50. }
  51.  
  52.  
  53. String readString() throws IOException {
  54.  
  55. while (!tok.hasMoreTokens()) {
  56. try {
  57. tok = new StringTokenizer(in.readLine());
  58. } catch (Exception e) {
  59. return null;
  60. }
  61. }
  62. return tok.nextToken();
  63. }
  64.  
  65. String readString(String s) throws IOException {
  66. while (!tok.hasMoreTokens()) {
  67. try {
  68. tok = new StringTokenizer(in.readLine(), s + "\n \t");
  69. } catch (Exception e) {
  70. return null;
  71. }
  72. }
  73. return tok.nextToken();
  74. }
  75.  
  76. int readInt() throws IOException {
  77. return Integer.parseInt(readString());
  78. }
  79.  
  80. int readInt(String s) throws IOException {
  81. return Integer.parseInt(readString(s));
  82. }
  83.  
  84. void solve() throws IOException {
  85.     int n = readInt();
  86.     char[] a = readString().toCharArray();
  87.     String ress="";
  88.     char[] res = new char[5000];
  89.     for(int i=0;i<26;i++)
  90.     {
  91.         res[0]=(char) ('a' + i);
  92.         for(int j=0;j<res.length-1;j++ ){
  93.         if(a[j] == '>'  ){
  94.             if((char) (res[j]+1)<'z')
  95.             break;
  96.             else
  97.             {
  98.             res[j+1] = (char)(res[j] + 1);
  99.             }
  100.         }
  101.         if(a[j] == '<' ){
  102.             if(((char) (res[j]-1)<'a'))
  103.             break;
  104.             else
  105.             {
  106.             res[j+1] = (char)(res[j] -1);
  107.             }
  108.         }
  109.         if(a[j] == '=' ){
  110.             res[j+1] = (char)(res[j]);
  111.         }
  112.         }
  113.     }
  114.  
  115. }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement