Everyone Ought to Have a Friend

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
7
down vote

favorite
1












An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type. Adjacent characters can be to the left, the right above or below, but not diagonals. For example in the following text H is isolated:



Ybb
YH%
%%%%


All the other characters are not isolated because each of them has at least one other character of the same type adjacent.



Your task is to write a program that takes a string as input and determines the number of isolated characters.



Scoring



You answer will be scored by two metrics. The first is the number of isolated characters in your program. You should aim to minimize this. The second will be the number of bytes in your program. You should minimize this as well. Program size will act as a tie breaker for the first criterion.



Additional Rules



  • You should support input on the printable ascii range plus any characters you use in your program.


  • You may consider a line break to either be a newline character or a newline followed by a line feed.


Test Cases



Ybb
YH%
%%%%


$1$




Aaaab
uuu
yyybbb


$2$




A


$1$




qqWWaaww


$0$










share|improve this question



















  • 1




    Is an empty string valid input and if so would it score 0? Also how flexible is input type? List of lines fine?
    – Veskah
    3 hours ago











  • Can newlines be isolated?
    – Jo King
    3 hours ago






  • 1




    @DimChtz Because it has a Y below it.
    – Erik the Outgolfer
    3 hours ago










  • @JoKing No it cannot.
    – W W
    3 hours ago










  • What do you mean by type? Is it corresponding to the character's codepoint?
    – AlexRacer
    3 hours ago














up vote
7
down vote

favorite
1












An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type. Adjacent characters can be to the left, the right above or below, but not diagonals. For example in the following text H is isolated:



Ybb
YH%
%%%%


All the other characters are not isolated because each of them has at least one other character of the same type adjacent.



Your task is to write a program that takes a string as input and determines the number of isolated characters.



Scoring



You answer will be scored by two metrics. The first is the number of isolated characters in your program. You should aim to minimize this. The second will be the number of bytes in your program. You should minimize this as well. Program size will act as a tie breaker for the first criterion.



Additional Rules



  • You should support input on the printable ascii range plus any characters you use in your program.


  • You may consider a line break to either be a newline character or a newline followed by a line feed.


Test Cases



Ybb
YH%
%%%%


$1$




Aaaab
uuu
yyybbb


$2$




A


$1$




qqWWaaww


$0$










share|improve this question



















  • 1




    Is an empty string valid input and if so would it score 0? Also how flexible is input type? List of lines fine?
    – Veskah
    3 hours ago











  • Can newlines be isolated?
    – Jo King
    3 hours ago






  • 1




    @DimChtz Because it has a Y below it.
    – Erik the Outgolfer
    3 hours ago










  • @JoKing No it cannot.
    – W W
    3 hours ago










  • What do you mean by type? Is it corresponding to the character's codepoint?
    – AlexRacer
    3 hours ago












up vote
7
down vote

favorite
1









up vote
7
down vote

favorite
1






1





An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type. Adjacent characters can be to the left, the right above or below, but not diagonals. For example in the following text H is isolated:



Ybb
YH%
%%%%


All the other characters are not isolated because each of them has at least one other character of the same type adjacent.



Your task is to write a program that takes a string as input and determines the number of isolated characters.



Scoring



You answer will be scored by two metrics. The first is the number of isolated characters in your program. You should aim to minimize this. The second will be the number of bytes in your program. You should minimize this as well. Program size will act as a tie breaker for the first criterion.



Additional Rules



  • You should support input on the printable ascii range plus any characters you use in your program.


  • You may consider a line break to either be a newline character or a newline followed by a line feed.


Test Cases



Ybb
YH%
%%%%


$1$




Aaaab
uuu
yyybbb


$2$




A


$1$




qqWWaaww


$0$










share|improve this question















An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type. Adjacent characters can be to the left, the right above or below, but not diagonals. For example in the following text H is isolated:



Ybb
YH%
%%%%


All the other characters are not isolated because each of them has at least one other character of the same type adjacent.



Your task is to write a program that takes a string as input and determines the number of isolated characters.



Scoring



You answer will be scored by two metrics. The first is the number of isolated characters in your program. You should aim to minimize this. The second will be the number of bytes in your program. You should minimize this as well. Program size will act as a tie breaker for the first criterion.



Additional Rules



  • You should support input on the printable ascii range plus any characters you use in your program.


  • You may consider a line break to either be a newline character or a newline followed by a line feed.


Test Cases



Ybb
YH%
%%%%


$1$




Aaaab
uuu
yyybbb


$2$




A


$1$




qqWWaaww


$0$







string code-challenge source-layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 3 hours ago

























asked 4 hours ago









W W

33.6k10148348




33.6k10148348







  • 1




    Is an empty string valid input and if so would it score 0? Also how flexible is input type? List of lines fine?
    – Veskah
    3 hours ago











  • Can newlines be isolated?
    – Jo King
    3 hours ago






  • 1




    @DimChtz Because it has a Y below it.
    – Erik the Outgolfer
    3 hours ago










  • @JoKing No it cannot.
    – W W
    3 hours ago










  • What do you mean by type? Is it corresponding to the character's codepoint?
    – AlexRacer
    3 hours ago












  • 1




    Is an empty string valid input and if so would it score 0? Also how flexible is input type? List of lines fine?
    – Veskah
    3 hours ago











  • Can newlines be isolated?
    – Jo King
    3 hours ago






  • 1




    @DimChtz Because it has a Y below it.
    – Erik the Outgolfer
    3 hours ago










  • @JoKing No it cannot.
    – W W
    3 hours ago










  • What do you mean by type? Is it corresponding to the character's codepoint?
    – AlexRacer
    3 hours ago







1




1




Is an empty string valid input and if so would it score 0? Also how flexible is input type? List of lines fine?
– Veskah
3 hours ago





Is an empty string valid input and if so would it score 0? Also how flexible is input type? List of lines fine?
– Veskah
3 hours ago













Can newlines be isolated?
– Jo King
3 hours ago




Can newlines be isolated?
– Jo King
3 hours ago




1




1




@DimChtz Because it has a Y below it.
– Erik the Outgolfer
3 hours ago




@DimChtz Because it has a Y below it.
– Erik the Outgolfer
3 hours ago












@JoKing No it cannot.
– W W
3 hours ago




@JoKing No it cannot.
– W W
3 hours ago












What do you mean by type? Is it corresponding to the character's codepoint?
– AlexRacer
3 hours ago




What do you mean by type? Is it corresponding to the character's codepoint?
– AlexRacer
3 hours ago










3 Answers
3






active

oldest

votes

















up vote
1
down vote














Clean, 0 (439 433 bytes)



Finally a challenge where I can score 0 with Clean!

(and normally it's bad at source-layout challenges!)



//module m
module m
import StdEnv,ArgEnv,Data.List,Data.Maybe
import StdEnv,ArgEnv,Data.List,Data.Maybe
Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]
Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]


Try it online!



The TIO link uses module main due to the way Clean is implemented on TIO, but module m will work if you name the file m.icl instead of main.icl as TIO does.



One of the lines explained:



Start // entry point
= let // define locals
l = mklines // `l` is argument split at newlines
[c \ c <-: getCommandLine.[1]]; // the second command-line arg turned into a [Char]
? x y // function ? of coordinate (x,y)
= mapMaybe // if the argument isn't Nothing
(k = k!?x) // try taking the `x`-th index
(l!?y) // of the `y`-th index of `l`
in // in the context of
sum [ // the sum of
1 // the integer one
\ i <- l & v <- [0..] // for every index in `l`
, _ <- i & u <- [0..] // for every subindex in `l`
| all ( // where all of the second argument
(<>)(?u v) // doesn't equal the first argument
) [?(u-1)v, ?(u+1)v, ?u(v-1), ?u(v+1)] // over every adjacent element
]





share|improve this answer





























    up vote
    0
    down vote














    MATL, 0 (54 bytes)



    TTTTf"Go@X!0JQJ&(d@_X!]***ggss
    %%%%f"Go@X!0JQJ&(d@_X!]


    Input is a cell array of strings, one for each line: 'line 1', 'line 2', 'and line 3'.



    Try it online! Or verify test cases and source code.






    share|improve this answer



























      up vote
      0
      down vote














      Jelly, 0 (41 27 bytes)



      ŒĠạþ`€Ẏ§1eⱮCS
      ŒĠạþ`€Ẏ§1eⱮCS


      Try it online!



      Takes input as list of lines. The first line in the code is never does anything and is only there to minimize isolated characters.



      ỴŒĠạþ`€Ẏ§1eⱮCS
      á»´ Split the text on newlines.
      ŒĠ Group the multidimensional indices by their value.
      € For each list of indices:
      ạ Take the absolute difference...
      þ` ...between each pair.
      Ẏ Concatenate the lists of differences.
      § Sum the x & y differences. This computes the Manhattan distance.
      At this point we have a list for each character in the text of
      Manhattan distances between it and it's identical characters.
      1eâ±® Is there a 1 in each of the lists? None for isolated characters.
      C Complement: 0 <-> 1.
      S Sum. Counts the isolated characters





      share|improve this answer






















        Your Answer




        StackExchange.ifUsing("editor", function ()
        return StackExchange.using("mathjaxEditing", function ()
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
        );
        );
        , "mathjax-editing");

        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "200"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: false,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













         

        draft saved


        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f172146%2feveryone-ought-to-have-a-friend%23new-answer', 'question_page');

        );

        Post as a guest






























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        1
        down vote














        Clean, 0 (439 433 bytes)



        Finally a challenge where I can score 0 with Clean!

        (and normally it's bad at source-layout challenges!)



        //module m
        module m
        import StdEnv,ArgEnv,Data.List,Data.Maybe
        import StdEnv,ArgEnv,Data.List,Data.Maybe
        Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]
        Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]


        Try it online!



        The TIO link uses module main due to the way Clean is implemented on TIO, but module m will work if you name the file m.icl instead of main.icl as TIO does.



        One of the lines explained:



        Start // entry point
        = let // define locals
        l = mklines // `l` is argument split at newlines
        [c \ c <-: getCommandLine.[1]]; // the second command-line arg turned into a [Char]
        ? x y // function ? of coordinate (x,y)
        = mapMaybe // if the argument isn't Nothing
        (k = k!?x) // try taking the `x`-th index
        (l!?y) // of the `y`-th index of `l`
        in // in the context of
        sum [ // the sum of
        1 // the integer one
        \ i <- l & v <- [0..] // for every index in `l`
        , _ <- i & u <- [0..] // for every subindex in `l`
        | all ( // where all of the second argument
        (<>)(?u v) // doesn't equal the first argument
        ) [?(u-1)v, ?(u+1)v, ?u(v-1), ?u(v+1)] // over every adjacent element
        ]





        share|improve this answer


























          up vote
          1
          down vote














          Clean, 0 (439 433 bytes)



          Finally a challenge where I can score 0 with Clean!

          (and normally it's bad at source-layout challenges!)



          //module m
          module m
          import StdEnv,ArgEnv,Data.List,Data.Maybe
          import StdEnv,ArgEnv,Data.List,Data.Maybe
          Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]
          Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]


          Try it online!



          The TIO link uses module main due to the way Clean is implemented on TIO, but module m will work if you name the file m.icl instead of main.icl as TIO does.



          One of the lines explained:



          Start // entry point
          = let // define locals
          l = mklines // `l` is argument split at newlines
          [c \ c <-: getCommandLine.[1]]; // the second command-line arg turned into a [Char]
          ? x y // function ? of coordinate (x,y)
          = mapMaybe // if the argument isn't Nothing
          (k = k!?x) // try taking the `x`-th index
          (l!?y) // of the `y`-th index of `l`
          in // in the context of
          sum [ // the sum of
          1 // the integer one
          \ i <- l & v <- [0..] // for every index in `l`
          , _ <- i & u <- [0..] // for every subindex in `l`
          | all ( // where all of the second argument
          (<>)(?u v) // doesn't equal the first argument
          ) [?(u-1)v, ?(u+1)v, ?u(v-1), ?u(v+1)] // over every adjacent element
          ]





          share|improve this answer
























            up vote
            1
            down vote










            up vote
            1
            down vote










            Clean, 0 (439 433 bytes)



            Finally a challenge where I can score 0 with Clean!

            (and normally it's bad at source-layout challenges!)



            //module m
            module m
            import StdEnv,ArgEnv,Data.List,Data.Maybe
            import StdEnv,ArgEnv,Data.List,Data.Maybe
            Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]
            Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]


            Try it online!



            The TIO link uses module main due to the way Clean is implemented on TIO, but module m will work if you name the file m.icl instead of main.icl as TIO does.



            One of the lines explained:



            Start // entry point
            = let // define locals
            l = mklines // `l` is argument split at newlines
            [c \ c <-: getCommandLine.[1]]; // the second command-line arg turned into a [Char]
            ? x y // function ? of coordinate (x,y)
            = mapMaybe // if the argument isn't Nothing
            (k = k!?x) // try taking the `x`-th index
            (l!?y) // of the `y`-th index of `l`
            in // in the context of
            sum [ // the sum of
            1 // the integer one
            \ i <- l & v <- [0..] // for every index in `l`
            , _ <- i & u <- [0..] // for every subindex in `l`
            | all ( // where all of the second argument
            (<>)(?u v) // doesn't equal the first argument
            ) [?(u-1)v, ?(u+1)v, ?u(v-1), ?u(v+1)] // over every adjacent element
            ]





            share|improve this answer















            Clean, 0 (439 433 bytes)



            Finally a challenge where I can score 0 with Clean!

            (and normally it's bad at source-layout challenges!)



            //module m
            module m
            import StdEnv,ArgEnv,Data.List,Data.Maybe
            import StdEnv,ArgEnv,Data.List,Data.Maybe
            Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]
            Start=let l=mklines[c\c<-:getCommandLine.[1]];?x y=mapMaybe(k=k!?x)(l!?y)in sum[1\i<-l&v<-[0..],_<-i&u<-[0..]|all((<>)(?u v))[?(u-1)v,?(u+1)v,?u(v-1),?u(v+1)]]


            Try it online!



            The TIO link uses module main due to the way Clean is implemented on TIO, but module m will work if you name the file m.icl instead of main.icl as TIO does.



            One of the lines explained:



            Start // entry point
            = let // define locals
            l = mklines // `l` is argument split at newlines
            [c \ c <-: getCommandLine.[1]]; // the second command-line arg turned into a [Char]
            ? x y // function ? of coordinate (x,y)
            = mapMaybe // if the argument isn't Nothing
            (k = k!?x) // try taking the `x`-th index
            (l!?y) // of the `y`-th index of `l`
            in // in the context of
            sum [ // the sum of
            1 // the integer one
            \ i <- l & v <- [0..] // for every index in `l`
            , _ <- i & u <- [0..] // for every subindex in `l`
            | all ( // where all of the second argument
            (<>)(?u v) // doesn't equal the first argument
            ) [?(u-1)v, ?(u+1)v, ?u(v-1), ?u(v+1)] // over every adjacent element
            ]






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 3 hours ago

























            answered 3 hours ago









            Οurous

            5,2831931




            5,2831931




















                up vote
                0
                down vote














                MATL, 0 (54 bytes)



                TTTTf"Go@X!0JQJ&(d@_X!]***ggss
                %%%%f"Go@X!0JQJ&(d@_X!]


                Input is a cell array of strings, one for each line: 'line 1', 'line 2', 'and line 3'.



                Try it online! Or verify test cases and source code.






                share|improve this answer
























                  up vote
                  0
                  down vote














                  MATL, 0 (54 bytes)



                  TTTTf"Go@X!0JQJ&(d@_X!]***ggss
                  %%%%f"Go@X!0JQJ&(d@_X!]


                  Input is a cell array of strings, one for each line: 'line 1', 'line 2', 'and line 3'.



                  Try it online! Or verify test cases and source code.






                  share|improve this answer






















                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote










                    MATL, 0 (54 bytes)



                    TTTTf"Go@X!0JQJ&(d@_X!]***ggss
                    %%%%f"Go@X!0JQJ&(d@_X!]


                    Input is a cell array of strings, one for each line: 'line 1', 'line 2', 'and line 3'.



                    Try it online! Or verify test cases and source code.






                    share|improve this answer













                    MATL, 0 (54 bytes)



                    TTTTf"Go@X!0JQJ&(d@_X!]***ggss
                    %%%%f"Go@X!0JQJ&(d@_X!]


                    Input is a cell array of strings, one for each line: 'line 1', 'line 2', 'and line 3'.



                    Try it online! Or verify test cases and source code.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 2 hours ago









                    Luis Mendo

                    72.6k885284




                    72.6k885284




















                        up vote
                        0
                        down vote














                        Jelly, 0 (41 27 bytes)



                        ŒĠạþ`€Ẏ§1eⱮCS
                        ŒĠạþ`€Ẏ§1eⱮCS


                        Try it online!



                        Takes input as list of lines. The first line in the code is never does anything and is only there to minimize isolated characters.



                        ỴŒĠạþ`€Ẏ§1eⱮCS
                        á»´ Split the text on newlines.
                        ŒĠ Group the multidimensional indices by their value.
                        € For each list of indices:
                        ạ Take the absolute difference...
                        þ` ...between each pair.
                        Ẏ Concatenate the lists of differences.
                        § Sum the x & y differences. This computes the Manhattan distance.
                        At this point we have a list for each character in the text of
                        Manhattan distances between it and it's identical characters.
                        1eâ±® Is there a 1 in each of the lists? None for isolated characters.
                        C Complement: 0 <-> 1.
                        S Sum. Counts the isolated characters





                        share|improve this answer


























                          up vote
                          0
                          down vote














                          Jelly, 0 (41 27 bytes)



                          ŒĠạþ`€Ẏ§1eⱮCS
                          ŒĠạþ`€Ẏ§1eⱮCS


                          Try it online!



                          Takes input as list of lines. The first line in the code is never does anything and is only there to minimize isolated characters.



                          ỴŒĠạþ`€Ẏ§1eⱮCS
                          á»´ Split the text on newlines.
                          ŒĠ Group the multidimensional indices by their value.
                          € For each list of indices:
                          ạ Take the absolute difference...
                          þ` ...between each pair.
                          Ẏ Concatenate the lists of differences.
                          § Sum the x & y differences. This computes the Manhattan distance.
                          At this point we have a list for each character in the text of
                          Manhattan distances between it and it's identical characters.
                          1eâ±® Is there a 1 in each of the lists? None for isolated characters.
                          C Complement: 0 <-> 1.
                          S Sum. Counts the isolated characters





                          share|improve this answer
























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote










                            Jelly, 0 (41 27 bytes)



                            ŒĠạþ`€Ẏ§1eⱮCS
                            ŒĠạþ`€Ẏ§1eⱮCS


                            Try it online!



                            Takes input as list of lines. The first line in the code is never does anything and is only there to minimize isolated characters.



                            ỴŒĠạþ`€Ẏ§1eⱮCS
                            á»´ Split the text on newlines.
                            ŒĠ Group the multidimensional indices by their value.
                            € For each list of indices:
                            ạ Take the absolute difference...
                            þ` ...between each pair.
                            Ẏ Concatenate the lists of differences.
                            § Sum the x & y differences. This computes the Manhattan distance.
                            At this point we have a list for each character in the text of
                            Manhattan distances between it and it's identical characters.
                            1eâ±® Is there a 1 in each of the lists? None for isolated characters.
                            C Complement: 0 <-> 1.
                            S Sum. Counts the isolated characters





                            share|improve this answer















                            Jelly, 0 (41 27 bytes)



                            ŒĠạþ`€Ẏ§1eⱮCS
                            ŒĠạþ`€Ẏ§1eⱮCS


                            Try it online!



                            Takes input as list of lines. The first line in the code is never does anything and is only there to minimize isolated characters.



                            ỴŒĠạþ`€Ẏ§1eⱮCS
                            á»´ Split the text on newlines.
                            ŒĠ Group the multidimensional indices by their value.
                            € For each list of indices:
                            ạ Take the absolute difference...
                            þ` ...between each pair.
                            Ẏ Concatenate the lists of differences.
                            § Sum the x & y differences. This computes the Manhattan distance.
                            At this point we have a list for each character in the text of
                            Manhattan distances between it and it's identical characters.
                            1eâ±® Is there a 1 in each of the lists? None for isolated characters.
                            C Complement: 0 <-> 1.
                            S Sum. Counts the isolated characters






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 23 mins ago

























                            answered 3 hours ago









                            dylnan

                            3,4982526




                            3,4982526



























                                 

                                draft saved


                                draft discarded















































                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f172146%2feveryone-ought-to-have-a-friend%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                Comments

                                Popular posts from this blog

                                Long meetings (6-7 hours a day): Being “babysat” by supervisor

                                Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                                Confectionery