solution to public class Solution {