class Dice extends React.Component {
  constructor() {
    super();
    this.state = {
    		value: '',
			words: location.search.substring(5).split('+')
		};

    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    this.setState({value: event.target.value});
  }

  handleSubmit(event) {
	var i=0, doc = document, docFrag = document.createDocumentFragment();
	for (; i < Number(this.state.value) ; i++){
	     var elem = doc.createElement('input');
	     elem.type = 'button';
	     elem.value = this.state.words[i];
	     docFrag.appendChild(elem);
	}
	doc.body.appendChild(docFrag);

    event.preventDefault();
}

  render() {
    return (
      <form onSubmit={this.handleSubmit}>
        <label>
          Pick the number of dices:
          <select value={this.state.value} onChange={this.handleChange}>
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
          </select>
        </label>
        <input type="submit" value="Submit" />
      </form>
    );
  }
}

ReactDOM.render(
  <Dice />,
  document.getElementById('root')
);
@@ -85,17 +85,16 @@
  %7B%0A    %09
-%09
 value: '
@@ -103,15 +103,34 @@
 %0A%09%09%09
-words: 
+input: decodeURIComponent(
 loca
@@ -157,18 +157,8 @@
 g(5)
-.split('+'
 )%0A%09%09
@@ -266,32 +266,131 @@
 ind(this);%0A  %7D%0A%0A
+  parseInput(input) %7B%0A    return input.split('%5Cn%5Cr').map(x =%3E x.split('%5Cn').filter(Boolean));%0A  %7D%0A%0A
   handleChange(e
@@ -442,32 +442,33 @@
 t.value%7D);%0A  %7D%0A%0A
+%0A
   handleSubmit(e
@@ -479,688 +479,79 @@
 ) %7B%0A
-%09var i=0, doc = document, docFrag = document.createDocumentFragment();%0A%09for (; i %3C Number(this.state.value) ; i++)%7B%0A%09     var elem = doc.createElement('input');%0A%09     elem.type = 'button';%0A%09     elem.value = this.state.words%5Bi%5D;%0A%09     docFrag.appendChild(elem);%0A%09%7D%0A%09doc.body.appendChild(docFrag);%0A%0A    event.preventDefault();%0A%7D%0A%0A  render() %7B%0A    return (%0A      %3Cform onSubmit=%7Bthis.handleSubmit%7D%3E%0A        %3Clabel%3E%0A          Pick the number of dices:%0A          %3Cselect value=%7Bthis.state.value%7D onChange=%7Bthis.handleChange%7D%3E%0A            %3Coption value=%221%22%3E1%3C/option%3E%0A            %3Coption value=%222%22%3E2%3C/option%3E%0A            %3Coption value=%223%22%3E3%3C/option%3E%0A          %3C/select%3E%0A        %3C/label
+  %7D%0A%0A  render() %7B%0A    return (%0A      %3Cform onSubmit=%7Bthis.handleSubmit%7D
 %3E%0A  

Add parseInput function