Java String Tokens

  • + 0 comments

    Hello !!

    I'm realy close to solve that problem but test no 9, he didn't give up. i fail that test, the single one. could you help me with an hint? My solution is this:

            Scanner scan = new Scanner(System.in);
        String s = scan.nextLine().trim();
        String[] tokens = s.split("[ !,?._'@]+");
        System.out.println(tokens.length);
        for (int i = 0; i < tokens.length; ++i) {
            System.out.println(tokens[i]);
        }
        scan.close();