Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public String deFront(String str)
  2. {
  3. if(str.length()>0)
  4. {
  5. if(str.charAt(0)==('a'))
  6. {
  7. if(str.length()>1)
  8. {
  9. if(str.charAt(1)==('b'))
  10. {
  11. return str;
  12. }
  13. if(str.length()==2)
  14. {
  15. return "a";
  16. }
  17. if(str.length()>2)
  18. {
  19. return "a" + str.substring(2);
  20. }
  21. }
  22. return "a";
  23. }
  24. if(str.length()>1)
  25. {
  26. if(str.charAt(1)==('b'))
  27. {
  28. if(str.length()>2)
  29. {
  30. return "b" + str.substring(2);
  31. }
  32. return "b";
  33. }
  34. if(str.length()>2)
  35. {
  36. return str.substring(2);
  37. }
  38. return "";
  39. }
  40. }
  41. return "error";
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement