Skip to main content
added 32 characters in body
Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

#Java - 119

class a{static{for(char c:(new java.util.Scanner(System.in)).nextLine().toCharArray())System.out.print((char)(c|32));}}
class a{static{for(char c:(new java.util.Scanner(System.in)).nextLine().toCharArray())System.out.print((char)(c|32));}}

Works for every character except @ which becomes the back-tick (`` `), and the following (foo:bar for foo becomes bar) :

\:|
]:}
^:~
_:

Even though this isn't a true solution because it has 5 cases where it doesn't work, I thought it was very interesting. It takes the characters of the input and does a bitwise or with ' ' (c|32).

I discovered that c^32 swaps the case when the input is only letters while solving a project euler problem. I wondered what would happen in I changed the XOR to an OR.

#Java - 119

class a{static{for(char c:(new java.util.Scanner(System.in)).nextLine().toCharArray())System.out.print((char)(c|32));}}

Works for every character except @ which becomes the back-tick (`` `), and the following (foo:bar for foo becomes bar) :

\:|
]:}
^:~
_:

Even though this isn't a true solution because it has 5 cases where it doesn't work, I thought it was very interesting. It takes the characters of the input and does a bitwise or with ' ' (c|32).

I discovered that c^32 swaps the case when the input is only letters while solving a project euler problem. I wondered what would happen in I changed the XOR to an OR.

#Java - 119

class a{static{for(char c:(new java.util.Scanner(System.in)).nextLine().toCharArray())System.out.print((char)(c|32));}}

Works for every character except @ which becomes the back-tick (`` `), and the following (foo:bar for foo becomes bar) :

\:|
]:}
^:~
_:

Even though this isn't a true solution because it has 5 cases where it doesn't work, I thought it was very interesting. It takes the characters of the input and does a bitwise or with ' ' (c|32).

I discovered that c^32 swaps the case when the input is only letters while solving a project euler problem. I wondered what would happen in I changed the XOR to an OR.

#Java - 119

class a{static{for(char c:(new java.util.Scanner(System.in)).nextLine().toCharArray())System.out.print((char)(c|32));}}

Works for every character except @ which becomes the back-tick (`` `), and the following (foo:bar for foo becomes bar) :

\:|
]:}
^:~
_:

Even though this isn't a true solution because it has 5 cases where it doesn't work, I thought it was very interesting. It takes the characters of the input and does a bitwise or with ' ' (c|32).

I discovered that c^32 swaps the case when the input is only letters while solving a project euler problem. I wondered what would happen in I changed the XOR to an OR.

#Java - 119

class a{static{for(char c:(new java.util.Scanner(System.in)).nextLine().toCharArray())System.out.print((char)(c|32));}}

Works for every character except @ which becomes the back-tick, and the following (foo:bar for foo becomes bar) :

\:|
]:}
^:~
_:

Even though this isn't a true solution because it has 5 cases where it doesn't work, I thought it was very interesting. It takes the characters of the input and does a bitwise or with ' ' (c|32).

I discovered that c^32 swaps the case when the input is only letters while solving a project euler problem. I wondered what would happen in I changed the XOR to an OR.

#Java - 119

class a{static{for(char c:(new java.util.Scanner(System.in)).nextLine().toCharArray())System.out.print((char)(c|32));}}

Works for every character except @ which becomes the back-tick (`` `), and the following (foo:bar for foo becomes bar) :

\:|
]:}
^:~
_:

Even though this isn't a true solution because it has 5 cases where it doesn't work, I thought it was very interesting. It takes the characters of the input and does a bitwise or with ' ' (c|32).

I discovered that c^32 swaps the case when the input is only letters while solving a project euler problem. I wondered what would happen in I changed the XOR to an OR.

Source Link
Justin
  • 21.3k
  • 9
  • 67
  • 114

#Java - 119

class a{static{for(char c:(new java.util.Scanner(System.in)).nextLine().toCharArray())System.out.print((char)(c|32));}}

Works for every character except @ which becomes the back-tick, and the following (foo:bar for foo becomes bar) :

\:|
]:}
^:~
_:

Even though this isn't a true solution because it has 5 cases where it doesn't work, I thought it was very interesting. It takes the characters of the input and does a bitwise or with ' ' (c|32).

I discovered that c^32 swaps the case when the input is only letters while solving a project euler problem. I wondered what would happen in I changed the XOR to an OR.