Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution{
- //code I need Help with:
- public static int palindromeCount(String s) {
- int count = 0;
- for (int i = 0; i < s.length(); i++) {
- for (int j = 0; j < s.length(); j++) {
- if (s.charAt(i) == s.charAt(j)) {
- }
- count++;
- }
- break;
- }
- return count;
- }
- //Given and can't change:
- public static void main(String[] args) throws IOException {
- Scanner in = new Scanner(System.in);
- final String fileName = System.getenv("OUTPUT_PATH");
- BufferedWriter bw = null;
- if (fileName != null) {
- bw = new BufferedWriter(new FileWriter(fileName));
- } else {
- bw = new BufferedWriter(new OutputStreamWriter(System.out));
- }
- int res;
- String s;
- try {
- s = in.nextLine();
- } catch (Exception e) {
- s = null;
- }
- res = palindromeCount(s);
- bw.write(String.valueOf(res));
- bw.newLine();
- bw.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement