Quick actions

cmd+k|ctrl+k

Navigation

Languages

URLIFY a given string

Snippet info

Language

Cpp

Visibility

public

Author

amangoyal1727

Created

2021-06-02T15:57:25.940933Z

Updated

2021-06-02T15:57:25.940933Z

#include <iostream>
using namespace std;

int main() {
   
   string input;
   getline (cin, input);
  
   string output = "";
   int j = 0;
   for(int i=0; i<input.length();i++){
       
       if(input[i] != ' '){
           output += input[i];
       }else{
           output += '%';
           output += '2';
           output += '0';
       }
   }
   
    input = output;
   cout<<input;
   
   
   
}
INFO