Aprender
Se insertó un espacio no deseado en la cadena.
Spacing errors occur when the spacebar is accidentally pressed during data entry, inserting an unwanted space character. This is common when typing quickly or when hands drift on the keyboard. The resulting string is one character longer with a space where none should exist.
Space inserted at position N: ABCD → AB CD
- 12345 → 123 45 (space inserted)
- HELLO → HEL LO (space in middle)
- AB-1234 → AB- 1234 (space after hyphen)
Cómo reconocerlo
- String contains unexpected space character
- Length is one character longer
- Space appears where data should be continuous
Errores comunes
- Overlooking spaces in visual inspection
- Confusing with intentional formatting
- Missing spaces at the start or end
Resolución paso a paso
Encuentre el error: Original '12345' vs Dado '123 45'
- Verificar longitudes: original tiene 5 caracteres, dado tiene 6
- Comparar posición 1: '1' = '1'
- Comparar posición 2: '2' = '2'
- Comparar posición 3: '3' = '3'
- Comparar posición 4: '4' vs ' ' - espacio encontrado
- Un espacio no deseado fue insertado después de la posición 3
- Los caracteres restantes '45' están desplazados una posición
Respuesta: Error de espaciado: espacio no deseado insertado entre '3' y '4' en posición 4