Wrong ans and runtime error

why my code is failing

take input like String x = sc.next();