Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.lang.*;
- import java.util.Locale;
- class Accumul {
- public static String accum(String s) {
- // your code
- var strb = new StringBuilder("");
- for (int i = 0; i < s.length(); i++) {
- String toBeAdded = String.valueOf(s.charAt(i));
- strb.append(toBeAdded.toUpperCase(Locale.ROOT));
- for (int aux = i; aux > 0; aux--) {
- strb.append(toBeAdded);
- }
- strb.append("-");
- }
- strb.setLength(Math.max(strb.length() - 1, 0));
- return strb.toString();
- }
- }
- public class Main {
- public static void main(String[] args) {
- System.out.println(Accumul.accum("abcd"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement