Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String deFront(String str)
- {
- if(str.length()>0)
- {
- if(str.charAt(0)==('a'))
- {
- if(str.length()>1)
- {
- if(str.charAt(1)==('b'))
- {
- return str;
- }
- if(str.length()==2)
- {
- return "a";
- }
- if(str.length()>2)
- {
- return "a" + str.substring(2);
- }
- }
- return "a";
- }
- if(str.length()>1)
- {
- if(str.charAt(1)==('b'))
- {
- if(str.length()>2)
- {
- return "b" + str.substring(2);
- }
- return "b";
- }
- if(str.length()>2)
- {
- return str.substring(2);
- }
- return "";
- }
- }
- return "error";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement