Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#C++ (gcc), (削除) 120 (削除ここまで)(削除) 133 (削除ここまで) 77 bytes

C++ (gcc), (削除) 120 (削除ここまで)(削除) 133 (削除ここまで) 77 bytes

#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}

Thanks to my father, who showed me a nifty trick for getting the characters directly from the input stream... and in turn almost halfed my byte count!

Old solution below using getline and joining substrings:

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

[Try it Online!][1]Try it Online!

My very first try on golfing. Feel free to give suggestions. [1]: https://tio.run/##Sy4o0E1PTv7/XzkztyC/qMQmM7@4pCg1MdeOKzOvRCE3MTNPQ7M6OSOxSCHZujwjMydVo7gkxcoqOTNPLz21RCNZUxPCzy8tsbFJtrFRUlCyrv3/PyS1uEQBRBgpODo5u7i6uSsYGhmbmJoBAA

#C++ (gcc), (削除) 120 (削除ここまで)(削除) 133 (削除ここまで) 77 bytes

#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}

Thanks to my father, who showed me a nifty trick for getting the characters directly from the input stream... and in turn almost halfed my byte count!

Old solution below using getline and joining substrings:

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

[Try it Online!][1]

My very first try on golfing. Feel free to give suggestions. [1]: https://tio.run/##Sy4o0E1PTv7/XzkztyC/qMQmM7@4pCg1MdeOKzOvRCE3MTNPQ7M6OSOxSCHZujwjMydVo7gkxcoqOTNPLz21RCNZUxPCzy8tsbFJtrFRUlCyrv3/PyS1uEQBRBgpODo5u7i6uSsYGhmbmJoBAA

C++ (gcc), (削除) 120 (削除ここまで)(削除) 133 (削除ここまで) 77 bytes

#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}

Thanks to my father, who showed me a nifty trick for getting the characters directly from the input stream... and in turn almost halfed my byte count!

Old solution below using getline and joining substrings:

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

Try it Online!

My very first try on golfing. Feel free to give suggestions.

added 33 characters in body
Source Link
Riker
  • 7.9k
  • 4
  • 40
  • 73

#C++ (gcc), (削除) 120 (削除ここまで) (削除) 133 (削除ここまで) 77 bytes

#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}
#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}

Thanks to my father, who showed me a nifty trick for getting the characters directly from the input stream... and in turn almost halfed my byte count!

Old solution below using getline and joining substrings:

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}
#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

[Try it Online!][1]

My very first try on golfing. Feel free to give suggestions. [1]: https://tio.run/##Sy4o0E1PTv7/XzkztyC/qMQmM7@4pCg1MdeOKzOvRCE3MTNPQ7M6OSOxSCHZujwjMydVo7gkxcoqOTNPLz21RCNZUxPCzy8tsbFJtrFRUlCyrv3/PyS1uEQBRBgpODo5u7i6uSsYGhmbmJoBAA

#C++ (gcc), (削除) 120 (削除ここまで) (削除) 133 (削除ここまで) 77 bytes

#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}

Thanks to my father, who showed me a nifty trick for getting the characters directly from the input stream... and in turn almost halfed my byte count!

Old solution below using getline and joining substrings:

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

[Try it Online!][1]

My very first try on golfing. Feel free to give suggestions. [1]: https://tio.run/##Sy4o0E1PTv7/XzkztyC/qMQmM7@4pCg1MdeOKzOvRCE3MTNPQ7M6OSOxSCHZujwjMydVo7gkxcoqOTNPLz21RCNZUxPCzy8tsbFJtrFRUlCyrv3/PyS1uEQBRBgpODo5u7i6uSsYGhmbmJoBAA

#C++ (gcc), (削除) 120 (削除ここまで) (削除) 133 (削除ここまで) 77 bytes

#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}

Thanks to my father, who showed me a nifty trick for getting the characters directly from the input stream... and in turn almost halfed my byte count!

Old solution below using getline and joining substrings:

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

[Try it Online!][1]

My very first try on golfing. Feel free to give suggestions. [1]: https://tio.run/##Sy4o0E1PTv7/XzkztyC/qMQmM7@4pCg1MdeOKzOvRCE3MTNPQ7M6OSOxSCHZujwjMydVo7gkxcoqOTNPLz21RCNZUxPCzy8tsbFJtrFRUlCyrv3/PyS1uEQBRBgpODo5u7i6uSsYGhmbmJoBAA

Corrected TIO; Improved byte count
Source Link
TheOutZ
  • 121
  • 3

#C++ (gcc), (削除) 120 (削除ここまで) 133(削除) 133 (削除ここまで) 77 bytes

#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}

Thanks to my father, who showed me a nifty trick for getting the characters directly from the input stream... and in turn almost halfed my byte count!

Old solution below using getline and joining substrings:

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

[Try it Online!][1]

My very first try on golfing. Looks pretty ungolfed and meh to me. Anyway, feelFeel free to give suggestions. [1]: https://tio.run/##JcsxDsIwDIXhnVNYZUmUgsRah5yCC5QQKg9xotpdQD17iMr0pP/pi7VelhhbO1OuZVVPRXRNcw4nYgXCY/JMbOxX9DVN/SZeQEZgPEIkDoHxXVaDBB74KvRJxiKQcx25ey/bsztD4826AQbc/7Js6r3g3tojif4A https://tio.run/##Sy4o0E1PTv7/XzkztyC/qMQmM7@4pCg1MdeOKzOvRCE3MTNPQ7M6OSOxSCHZujwjMydVo7gkxcoqOTNPLz21RCNZUxPCzy8tsbFJtrFRUlCyrv3/PyS1uEQBRBgpODo5u7i6uSsYGhmbmJoBAA

#C++ (gcc), (削除) 120 (削除ここまで) 133 bytes

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

[Try it Online!][1]

My very first try on golfing. Looks pretty ungolfed and meh to me. Anyway, feel free to give suggestions. [1]: https://tio.run/##JcsxDsIwDIXhnVNYZUmUgsRah5yCC5QQKg9xotpdQD17iMr0pP/pi7VelhhbO1OuZVVPRXRNcw4nYgXCY/JMbOxX9DVN/SZeQEZgPEIkDoHxXVaDBB74KvRJxiKQcx25ey/bsztD4826AQbc/7Js6r3g3tojif4A

#C++ (gcc), (削除) 120 (削除ここまで) (削除) 133 (削除ここまで) 77 bytes

#import<iostream>
int main(){char c;while(std::cin.get(c))std::cout<<c<<" ";}

Thanks to my father, who showed me a nifty trick for getting the characters directly from the input stream... and in turn almost halfed my byte count!

Old solution below using getline and joining substrings:

#import<iostream>
int i;int main(){std::string s,n;std::getline(std::cin,n);for(;i<n.size();i++){s+=n.substr(i,1)+" ";}std::cout<<s;}

[Try it Online!][1]

My very first try on golfing. Feel free to give suggestions. [1]: https://tio.run/##Sy4o0E1PTv7/XzkztyC/qMQmM7@4pCg1MdeOKzOvRCE3MTNPQ7M6OSOxSCHZujwjMydVo7gkxcoqOTNPLz21RCNZUxPCzy8tsbFJtrFRUlCyrv3/PyS1uEQBRBgpODo5u7i6uSsYGhmbmJoBAA

Cin is making issues, so I'm using getline
Source Link
TheOutZ
  • 121
  • 3
Loading
Source Link
TheOutZ
  • 121
  • 3
Loading

AltStyle によって変換されたページ (->オリジナル) /